[med-svn] [soapdenovo2] 05/09: Imported Upstream version 240+dfsg

Sascha Steinbiss sascha at steinbiss.name
Fri May 27 22:37:08 UTC 2016


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

sascha-guest pushed a commit to branch master
in repository soapdenovo2.

commit 2da3aa442a5a493d3caaa2723925fa4ba41caa78
Author: Sascha Steinbiss <sascha at steinbiss.name>
Date:   Fri May 27 20:23:32 2016 +0000

    Imported Upstream version 240+dfsg
---
 INSTALL                            |   22 +
 MANUAL                             |   36 +-
 Makefile                           |   76 ++
 VERSION                            |    1 +
 sparsePregraph/Makefile            |   16 +-
 sparsePregraph/build_graph.cpp     |    6 +-
 sparsePregraph/build_preArc.cpp    |   10 +-
 sparsePregraph/change.log          |   24 +
 sparsePregraph/global.cpp          |    2 +-
 sparsePregraph/inc/bam.h           |  711 -------------------
 sparsePregraph/inc/bgzf.h          |  136 ----
 sparsePregraph/inc/global.h        |    2 +-
 sparsePregraph/inc/sam.h           |  100 ---
 sparsePregraph/inc/spinLock.h      |   40 --
 sparsePregraph/inc/xcurses.h.gch   |  Bin 0 -> 3154808 bytes
 sparsePregraph/inc/zconf.h         |  332 ---------
 sparsePregraph/inc/zlib.h          | 1359 ------------------------------------
 sparsePregraph/main.cpp            |   11 +
 sparsePregraph/multi_threads.cpp   |   20 +-
 sparsePregraph/pregraph_sparse.cpp |   55 +-
 standardPregraph/INSTALL           |   35 -
 standardPregraph/Makefile          |   18 +-
 standardPregraph/VERSION           |    1 -
 standardPregraph/inc/bam.h         |  711 -------------------
 standardPregraph/inc/bgzf.h        |  136 ----
 standardPregraph/inc/def.h         |    8 +
 standardPregraph/inc/sam.h         |  100 ---
 standardPregraph/inc/zconf.h       |  332 ---------
 standardPregraph/inc/zlib.h        | 1359 ------------------------------------
 standardPregraph/iterate.c         |  112 ++-
 standardPregraph/main.c            |   16 +-
 standardPregraph/prlHashReads.c    |   17 +-
 standardPregraph/prlRead2path.c    |   10 +-
 standardPregraph/read2edge.c       |   69 +-
 standardPregraph/readseq1by1.c     |   22 +-
 update.log                         |   27 +
 36 files changed, 468 insertions(+), 5464 deletions(-)

diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..104ebdd
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,22 @@
+
+Installation of SOAPdenovo-V2.04
+
+Ruibang Luo, 2012-7-10
+Zhenyu Li, 2012-7-10
+
+********************************************************************
+
+Pre-configurated Makefile was designed to handle most circumstances.
+
+************
+MAKE
+************
+
+Type "make" at root of unpacked folder.
+Type "make debug=1" at root of npacked folder to compile the debug version.
+
+************
+CLEAN
+************
+
+Type "make clean" at root of unpacked folder.
diff --git a/MANUAL b/MANUAL
index 25604f3..ccc07a4 100644
--- a/MANUAL
+++ b/MANUAL
@@ -73,12 +73,23 @@ Once the configuration file is available, a typical way to run the assembler is:
 ${bin} all -s config_file -K 63 -R -o graph_prefix 1>ass.log 2>ass.err
 
 User can also choose to run the assembly process step by step as:
-${bin} pregraph -s config_file -K 63 -R -o graph_prefix 1>pregraph.log 2>pregraph.err
+step1:
+${bin} pregraph -s config_file -K 63 -R -o graph_prefix 1>pregraph.log 2>pregraph.err  
+OR
+${bin} sparse_pregraph -s config_file -K 63 -z 5000000000 -R -o graph_prefix 1>pregraph.log 2>pregraph.err 
+
+step2:
 ${bin} contig -g graph_prefix -R 1>contig.log 2>contig.err
+
+step3:
 ${bin} map -s config_file -g graph_prefix 1>map.log 2>map.err
+
+step4:
 ${bin} scaff -g graph_prefix -F 1>scaff.log 2>scaff.err
 
-3.Options:
+3.Options
+
+3.1 Options for all (pregraph-contig-map-scaff)
   -s <string>    configFile: the config file of solexa reads
   -o <string>    outputGraph: prefix of output graph file name
   -K <int>       kmer(min 13, max 63/127): kmer size, [23]
@@ -106,6 +117,19 @@ ${bin} scaff -g graph_prefix -F 1>scaff.log 2>scaff.err
   -N <int>       genomeSize: genome size for statistics, [0]
   -V (optional)  output visualization information of assembly, [NO]
 
+3.2 Options for sparse_pregraph
+  Usage: ./SOAPdenovo2 sparse_pregraph -s configFile -K kmer -z genomeSize -o outputGraph [-g maxKmerEdgeLength -d kmerFreqCutoff -e kmerEdgeFreqCutoff -R -r runMode -p n_cpu]
+  -s <string>     configFile: the config file of solexa reads
+  -K <int>        kmer(min 13, max 63/127): kmer size, [23]
+  -g <int>        maxKmerEdgeLength(min 1, max 25): number of skipped intermediate kmers, [15]
+  -z <int>        genomeSize(mandatory): estimated genome size
+  -d <int>        kmerFreqCutoff: delete kmers with frequency no larger than,[1]
+  -e <int>        kmerEdgeFreqCutoff: delete kmers' related edge with frequency no larger than [1]
+  -R (optional)   output extra information for resolving repeats in contig step, [NO]
+  -r <int>        runMode: 0 build graph & build edge and preArc, 1 load graph by prefix & build edge and preArc, 2 build graph only, 3 build edges only, 4 build preArcs only [0]
+  -p <int>        n_cpu: number of cpu for use,[8]
+  -o <int>        outputGraph: prefix of output graph file name
+
 4. Output files
 
 4.1 These files are output as assembly results:
@@ -122,7 +146,13 @@ b. *.scafSeq
 
 The program accepts odd numbers between 13 and 31. Larger K-mers would have higher rate of uniqueness in the genome and would make the graph simpler, but it requires deep sequencing depth and longer read length to guarantee the overlap at any genomic location.
 
-5.2 How to set library rank?
+The sparse pregraph module usually needs 2-10bp smaller kmer length to achieve the same performance as the original pregraph module.
+
+5.2 How to set genome size(-z) for sparse pregraph module?
+
+The -z parameter for sparse pregraph should be set a litter larger than the real genome size, it is used to allocate memory.
+
+5.3 How to set library rank?
 
 SOAPdenovo will use the pair-end libraries with insert size from smaller to larger to construct scaffolds. Libraries with the same rank would be used at the same time. For example, in a dataset of a human genome, we set five ranks for five libraries with insert size 200-bp, 500-bp, 2-Kb, 5-Kb and 10-Kb, separately. It is desired that the pairs in each rank provide adequate physical coverage of the genome.
 
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..8874681
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,76 @@
+CC = g++
+ifdef debug
+CFLAGS=         -O0 -g -fomit-frame-pointer
+else
+CFLAGS=         -O4 -fomit-frame-pointer
+endif
+
+SUBDIRS = sparsePregraph standardPregraph
+PROG=       SOAPdenovo-63mer SOAPdenovo-127mer
+INCLUDES=   -I./sparsePregraph/inc -I./standardPregraph/inc
+
+LIBPATH=    -L/lib64 -L/usr/lib64 -L./sparsePregraph/inc -L./standardPregraph/inc
+LIBS=       -pthread -lz -lm
+EXTRA_FLAGS= 
+
+BIT_ERR = 0
+ifeq (,$(findstring $(shell uname -m), x86_64 ppc64 ia64))
+BIT_ERR = 1
+endif
+
+ifneq (,$(findstring Linux,$(shell uname)))
+EXTRA_FLAGS += -Wl,--hash-style=both
+LIBS += -lbam -lrt
+endif
+
+ifneq (,$(findstring Unix,$(shell uname)))
+EXTRA_FLAGS += -Wl,--hash-style=both
+LIBS += -lbam -lrt
+endif
+
+ifneq (,$(findstring Darwin,$(shell uname)))
+LIBS += -lbammac
+endif
+
+ifneq (,$(findstring $(shell uname -m), x86_64))
+CFLAGS += -m64
+endif
+
+ifneq (,$(findstring $(shell uname -m), ia64))
+CFLAGS +=
+endif
+
+ifneq (,$(findstring $(shell uname -m), ppc64))
+CFLAGS += -mpowerpc64
+endif
+
+
+all: SOAPdenovo-63mer SOAPdenovo-127mer
+
+ifdef debug
+SOAPdenovo-63mer:
+	@cd sparsePregraph;make 63mer=1 debug=1;cd ..;
+	@cd standardPregraph;make 63mer=1 debug=1;cd ..;
+	@$(CC) sparsePregraph/*.o standardPregraph/*.o $(LIBPATH) $(LIBS) $(EXTRA_FLAGS) -o SOAPdenovo-63mer
+SOAPdenovo-127mer:
+	@cd sparsePregraph;make 127mer=1 debug=1;cd ..;
+	@cd standardPregraph;make 127mer=1 debug=1;cd ..;
+	@$(CC) sparsePregraph/*.o standardPregraph/*.o $(LIBPATH) $(LIBS) $(EXTRA_FLAGS) -o SOAPdenovo-127mer
+clean:
+	@cd sparsePregraph;make clean;cd ..;
+	@cd standardPregraph;make clean;cd ..;
+	@rm SOAPdenovo-63mer SOAPdenovo-127mer -f
+else
+SOAPdenovo-63mer:
+	@cd sparsePregraph;make 63mer=1;cd ..;
+	@cd standardPregraph;make 63mer=1;cd ..;
+	@$(CC) sparsePregraph/*.o standardPregraph/*.o $(LIBPATH) $(LIBS) $(EXTRA_FLAGS) -o SOAPdenovo-63mer
+SOAPdenovo-127mer:
+	@cd sparsePregraph;make 127mer=1;cd ..;
+	@cd standardPregraph;make 127mer=1;cd ..;
+	@$(CC) sparsePregraph/*.o standardPregraph/*.o $(LIBPATH) $(LIBS) $(EXTRA_FLAGS) -o SOAPdenovo-127mer
+clean:
+	@cd sparsePregraph;make clean;cd ..;
+	@cd standardPregraph;make clean;cd ..;
+	@rm SOAPdenovo-63mer SOAPdenovo-127mer -f
+endif
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..080c272
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+2.04-r240
diff --git a/sparsePregraph/Makefile b/sparsePregraph/Makefile
index da6a391..9c88a75 100644
--- a/sparsePregraph/Makefile
+++ b/sparsePregraph/Makefile
@@ -1,5 +1,10 @@
-CC=             gcc
+CC=            g++ # /opt/blc/gcc-4.5.0/bin/gcc #gcc
+ifdef debug
+CFLAGS=         -O0 -g -fomit-frame-pointer #-static #-mcrc32 -march=core2 -msse4.1 -msse4.2
+else
 CFLAGS=         -O4 -fomit-frame-pointer #-static #-mcrc32 -march=core2 -msse4.1 -msse4.2
+endif
+
 DFLAGS=         
 OBJS=		build_graph.o build_edge.o multi_threads.o \
 			build_preArc.o pregraph_sparse.o io_func.o\
@@ -8,7 +13,7 @@ PROG=
 INCLUDES=	-I./inc
 SUBDIRS=    . 
 LIBPATH=	-L/usr/lib64
-LIBS=       -pthread -lz -lstdc++ -L./inc
+LIBS=       -pthread -lz -L./inc
 EXTRA_FLAGS=
 VERSION =    1.0.3
 
@@ -59,7 +64,8 @@ endif
 		@printf "Compiling $<...                             \r"; \
 		$(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $< || echo "Error in command: $(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $<"
 
-all:		pregraph_sparse
+all:		clean $(OBJS) 
+#pregraph_sparse
 
 .PHONY:all clean install
 
@@ -68,7 +74,7 @@ envTest:
 
 pregraph_sparse: clean	envTest $(OBJS)
 		@printf "Linking...                                                       \r"
-		@$(CC) $(CFLAGS)$(INCLUDES) -o $(PROG)  $(OBJS) $(LIBPATH) $(LIBS) $(ENTRAFLAGS)
+		#@$(CC) $(CFLAGS)$(INCLUDES) -o $(PROG)  $(OBJS) $(LIBPATH) $(LIBS) $(ENTRAFLAGS)
 		@printf "$(PROG) compilation done.\n";
 
 clean:
@@ -76,5 +82,5 @@ clean:
 		@printf "$(PROG) cleaning done.\n";
 
 install:
-		@mkdir -p ../bin; cp $(PROG) ../bin/
+		@cp $(PROG) ../bin/
 		@printf "$(PROG) installed at ../bin/$(PROG)\n"
diff --git a/sparsePregraph/build_graph.cpp b/sparsePregraph/build_graph.cpp
index c26af27..be011bf 100644
--- a/sparsePregraph/build_graph.cpp
+++ b/sparsePregraph/build_graph.cpp
@@ -37,7 +37,7 @@ Input:
     3. K_size:  kmer size
     3. gap:     the skipped distance
     4. read_num:        the number of reads for processing
-    5. thrd_num:        the thread number for building sparse de-Brujin graph
+    5. thrd_num_s:        the thread number for building sparse de-Brujin graph
     6. thrd_id:     current thread's id
     7. round:           current building round (1,2)
 Output:
@@ -45,11 +45,11 @@ Output:
 Return:
     None.
 *************************************************/
-void run_process_threaded ( struct hashtable2 * ht, pthread_spinlock_t * locks, int K_size, int gap, size_t read_num, int thrd_num, int thrd_id, int round )
+void run_process_threaded ( struct hashtable2 * ht, pthread_spinlock_t * locks, int K_size, int gap, size_t read_num, int thrd_num_s, int thrd_id, int round )
 {
 	read_t read_tmp;
 
-	for ( int i = thrd_id; i < read_num; i += thrd_num )
+	for ( int i = thrd_id; i < read_num; i += thrd_num_s )
 	{
 		int bad_flag = 0;
 		filter_N ( seq_t[i], bad_flag );
diff --git a/sparsePregraph/build_preArc.cpp b/sparsePregraph/build_preArc.cpp
index 59f9d54..7cf5c25 100644
--- a/sparsePregraph/build_preArc.cpp
+++ b/sparsePregraph/build_preArc.cpp
@@ -1013,7 +1013,7 @@ Return:
 void build_preArc_threaded ( preArc_array * arc_arr, vertex_hash2 * v_ht, int K_size, int cut_off_len, vector<string> *in_filenames_vt, int thread_num )
 {
 	//create main io thread
-	int read_buf_sz = 102400 * thrd_num;
+	int read_buf_sz = 102400 * thrd_num_s;
 	read_buf0 = new string[read_buf_sz];
 	read_buf1 = new string[read_buf_sz];
 	io_stat0 = 1; //must be one, if io_stat0 =0 ,the io thread will work immediately
@@ -1035,9 +1035,9 @@ void build_preArc_threaded ( preArc_array * arc_arr, vertex_hash2 * v_ht, int K_
 	fprintf ( stderr, "1 io thread initialized.\n" );
 	//create work threads ..
 	//fprintf(stderr,"Creating work threads ...\n");
-	pthread_t threads[thrd_num];
-	unsigned char thrdSignal[thrd_num + 1];
-	PARAMETER paras[thrd_num];
+	pthread_t threads[thrd_num_s];
+	unsigned char thrdSignal[thrd_num_s + 1];
+	PARAMETER paras[thrd_num_s];
 	locks = ( pthread_spinlock_t * ) calloc ( arc_arr->array_sz, sizeof ( pthread_spinlock_t ) );
 
 	//init as unlock stat ..
@@ -1046,7 +1046,7 @@ void build_preArc_threaded ( preArc_array * arc_arr, vertex_hash2 * v_ht, int K_
 		locks[i] = 1;
 	}
 
-	for ( int k = 0; k < thrd_num; k++ )
+	for ( int k = 0; k < thrd_num_s; k++ )
 	{
 		thrdSignal[k + 1] = 0;
 		paras[k].threadID = k;
diff --git a/sparsePregraph/change.log b/sparsePregraph/change.log
new file mode 100644
index 0000000..99a26ff
--- /dev/null
+++ b/sparsePregraph/change.log
@@ -0,0 +1,24 @@
+1.change the edge node 
+
+old:
+struct edge_node
+{
+	uint64_t edge��50��edge_cov:7,len:6,used:1��
+	struct edge_node *nxt_edge;
+};
+
+now:
+struct edge_node
+{
+	uint64_t edge;
+	uint64_t edge_cov:7,len:6,used:1,deleted:1;
+	struct edge_node *nxt_edge;
+};
+
+so, the LoadGraph... function can't work when performed on an old hash data set.
+
+
+2. support bam format 
+3. support -R
+4. support 127mer
+5. build vertex K_size -> gap . 
\ No newline at end of file
diff --git a/sparsePregraph/global.cpp b/sparsePregraph/global.cpp
index 09ef59a..2a49afd 100644
--- a/sparsePregraph/global.cpp
+++ b/sparsePregraph/global.cpp
@@ -34,7 +34,7 @@ uint64_t GenomeSize = 0;
 int solve = 0; //default not solving repeats
 int run_mode = 0;
 
-int thrd_num = 8;
+int thrd_num_s = 8;
 
 size_t * edge_cnt_total = NULL; //used int lock strategy
 size_t * bucket_count_total = NULL; //used in lock strategy
diff --git a/sparsePregraph/inc/bam.h b/sparsePregraph/inc/bam.h
deleted file mode 100644
index cb73716..0000000
--- a/sparsePregraph/inc/bam.h
+++ /dev/null
@@ -1,711 +0,0 @@
-/* The MIT License
-
-   Copyright (c) 2008 Genome Research Ltd (GRL).
-
-   Permission is hereby granted, free of charge, to any person obtaining
-   a copy of this software and associated documentation files (the
-   "Software"), to deal in the Software without restriction, including
-   without limitation the rights to use, copy, modify, merge, publish,
-   distribute, sublicense, and/or sell copies of the Software, and to
-   permit persons to whom the Software is furnished to do so, subject to
-   the following conditions:
-
-   The above copyright notice and this permission notice shall be
-   included in all copies or substantial portions of the Software.
-
-   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-   SOFTWARE.
-*/
-
-/* Contact: Heng Li <lh3 at sanger.ac.uk> */
-
-#ifndef BAM_BAM_H
-#define BAM_BAM_H
-
-/*!
-  @header
-
-  BAM library provides I/O and various operations on manipulating files
-  in the BAM (Binary Alignment/Mapping) or SAM (Sequence Alignment/Map)
-  format. It now supports importing from or exporting to TAM, sorting,
-  merging, generating pileup, and quickly retrieval of reads overlapped
-  with a specified region.
-
-  @copyright Genome Research Ltd.
- */
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifndef BAM_LITE
-#define BAM_VIRTUAL_OFFSET16
-#include "bgzf.h"
-/*! @abstract BAM file handler */
-typedef BGZF * bamFile;
-#define bam_open(fn, mode) bgzf_open(fn, mode)
-#define bam_dopen(fd, mode) bgzf_fdopen(fd, mode)
-#define bam_close(fp) bgzf_close(fp)
-#define bam_read(fp, buf, size) bgzf_read(fp, buf, size)
-#define bam_write(fp, buf, size) bgzf_write(fp, buf, size)
-#define bam_tell(fp) bgzf_tell(fp)
-#define bam_seek(fp, pos, dir) bgzf_seek(fp, pos, dir)
-#else
-#define BAM_TRUE_OFFSET
-#include <zlib.h>
-typedef gzFile bamFile;
-#define bam_open(fn, mode) gzopen(fn, mode)
-#define bam_dopen(fd, mode) gzdopen(fd, mode)
-#define bam_close(fp) gzclose(fp)
-#define bam_read(fp, buf, size) gzread(fp, buf, size)
-/* no bam_write/bam_tell/bam_seek() here */
-#endif
-
-/*! @typedef
-  @abstract Structure for the alignment header.
-  @field n_targets   number of reference sequences
-  @field target_name names of the reference sequences
-  @field target_len  lengths of the referene sequences
-  @field dict        header dictionary
-  @field hash        hash table for fast name lookup
-  @field rg2lib      hash table for @RG-ID -> LB lookup
-  @field l_text      length of the plain text in the header
-  @field text        plain text
-
-  @discussion Field hash points to null by default. It is a private
-  member.
- */
-typedef struct
-{
-	int32_t n_targets;
-	char ** target_name;
-	uint32_t * target_len;
-	void * dict, *hash, *rg2lib;
-	int l_text;
-	char * text;
-} bam_header_t;
-
-/*! @abstract the read is paired in sequencing, no matter whether it is mapped in a pair */
-#define BAM_FPAIRED        1
-/*! @abstract the read is mapped in a proper pair */
-#define BAM_FPROPER_PAIR   2
-/*! @abstract the read itself is unmapped; conflictive with BAM_FPROPER_PAIR */
-#define BAM_FUNMAP         4
-/*! @abstract the mate is unmapped */
-#define BAM_FMUNMAP        8
-/*! @abstract the read is mapped to the reverse strand */
-#define BAM_FREVERSE      16
-/*! @abstract the mate is mapped to the reverse strand */
-#define BAM_FMREVERSE     32
-/*! @abstract this is read1 */
-#define BAM_FREAD1        64
-/*! @abstract this is read2 */
-#define BAM_FREAD2       128
-/*! @abstract not primary alignment */
-#define BAM_FSECONDARY   256
-/*! @abstract QC failure */
-#define BAM_FQCFAIL      512
-/*! @abstract optical or PCR duplicate */
-#define BAM_FDUP        1024
-
-#define BAM_OFDEC          0
-#define BAM_OFHEX          1
-#define BAM_OFSTR          2
-
-/*! @abstract defautl mask for pileup */
-#define BAM_DEF_MASK (BAM_FUNMAP | BAM_FSECONDARY | BAM_FQCFAIL | BAM_FDUP)
-
-#define BAM_CORE_SIZE   sizeof(bam1_core_t)
-
-/**
- * Describing how CIGAR operation/length is packed in a 32-bit integer.
- */
-#define BAM_CIGAR_SHIFT 4
-#define BAM_CIGAR_MASK  ((1 << BAM_CIGAR_SHIFT) - 1)
-
-/*
-  CIGAR operations.
- */
-/*! @abstract CIGAR: match */
-#define BAM_CMATCH      0
-/*! @abstract CIGAR: insertion to the reference */
-#define BAM_CINS        1
-/*! @abstract CIGAR: deletion from the reference */
-#define BAM_CDEL        2
-/*! @abstract CIGAR: skip on the reference (e.g. spliced alignment) */
-#define BAM_CREF_SKIP   3
-/*! @abstract CIGAR: clip on the read with clipped sequence present in qseq */
-#define BAM_CSOFT_CLIP  4
-/*! @abstract CIGAR: clip on the read with clipped sequence trimmed off */
-#define BAM_CHARD_CLIP  5
-/*! @abstract CIGAR: padding */
-#define BAM_CPAD        6
-
-/*! @typedef
-  @abstract Structure for core alignment information.
-  @field  tid     chromosome ID, defined by bam_header_t
-  @field  pos     0-based leftmost coordinate
-  @field  strand  strand; 0 for forward and 1 otherwise
-  @field  bin     bin calculated by bam_reg2bin()
-  @field  qual    mapping quality
-  @field  l_qname length of the query name
-  @field  flag    bitwise flag
-  @field  n_cigar number of CIGAR operations
-  @field  l_qseq  length of the query sequence (read)
- */
-typedef struct
-{
-	int32_t tid;
-	int32_t pos;
-	uint32_t bin: 16, qual: 8, l_qname: 8;
-	uint32_t flag: 16, n_cigar: 16;
-	int32_t l_qseq;
-	int32_t mtid;
-	int32_t mpos;
-	int32_t isize;
-} bam1_core_t;
-
-/*! @typedef
-  @abstract Structure for one alignment.
-  @field  core       core information about the alignment
-  @field  l_aux      length of auxiliary data
-  @field  data_len   current length of bam1_t::data
-  @field  m_data     maximum length of bam1_t::data
-  @field  data       all variable-length data, concatenated; structure: cigar-qname-seq-qual-aux
-
-  @discussion Notes:
-
-   1. qname is zero tailing and core.l_qname includes the tailing '\0'.
-   2. l_qseq is calculated from the total length of an alignment block
-      on reading or from CIGAR.
- */
-typedef struct
-{
-	bam1_core_t core;
-	int l_aux, data_len, m_data;
-	uint8_t * data;
-} bam1_t;
-
-#define bam1_strand(b) (((b)->core.flag&BAM_FREVERSE) != 0)
-#define bam1_mstrand(b) (((b)->core.flag&BAM_FMREVERSE) != 0)
-
-/*! @function
-  @abstract  Get the CIGAR array
-  @param  b  pointer to an alignment
-  @return    pointer to the CIGAR array
-
-  @discussion In the CIGAR array, each element is a 32-bit integer. The
-  lower 4 bits gives a CIGAR operation and the higher 28 bits keep the
-  length of a CIGAR.
- */
-#define bam1_cigar(b) ((uint32_t*)((b)->data + (b)->core.l_qname))
-
-/*! @function
-  @abstract  Get the name of the query
-  @param  b  pointer to an alignment
-  @return    pointer to the name string, null terminated
- */
-#define bam1_qname(b) ((char*)((b)->data))
-
-/*! @function
-  @abstract  Get query sequence
-  @param  b  pointer to an alignment
-  @return    pointer to sequence
-
-  @discussion Each base is encoded in 4 bits: 1 for A, 2 for C, 4 for G,
-  8 for T and 15 for N. Two bases are packed in one byte with the base
-  at the higher 4 bits having smaller coordinate on the read. It is
-  recommended to use bam1_seqi() macro to get the base.
- */
-#define bam1_seq(b) ((b)->data + (b)->core.n_cigar*4 + (b)->core.l_qname)
-
-/*! @function
-  @abstract  Get query quality
-  @param  b  pointer to an alignment
-  @return    pointer to quality string
- */
-#define bam1_qual(b) ((b)->data + (b)->core.n_cigar*4 + (b)->core.l_qname + ((b)->core.l_qseq + 1)/2)
-
-/*! @function
-  @abstract  Get a base on read
-  @param  s  Query sequence returned by bam1_seq()
-  @param  i  The i-th position, 0-based
-  @return    4-bit integer representing the base.
- */
-#define bam1_seqi(s, i) ((s)[(i)/2] >> 4*(1-(i)%2) & 0xf)
-
-/*! @function
-  @abstract  Get query sequence and quality
-  @param  b  pointer to an alignment
-  @return    pointer to the concatenated auxiliary data
- */
-#define bam1_aux(b) ((b)->data + (b)->core.n_cigar*4 + (b)->core.l_qname + (b)->core.l_qseq + ((b)->core.l_qseq + 1)/2)
-
-#ifndef kroundup32
-/*! @function
-  @abstract  Round an integer to the next closest power-2 integer.
-  @param  x  integer to be rounded (in place)
-  @discussion x will be modified.
- */
-#define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x))
-#endif
-
-/*!
-  @abstract Whether the machine is big-endian; modified only in
-  bam_header_init().
- */
-extern int bam_is_be;
-
-/*! @abstract Table for converting a nucleotide character to the 4-bit encoding. */
-extern unsigned char bam_nt16_table[256];
-
-/*! @abstract Table for converting a 4-bit encoded nucleotide to a letter. */
-extern char * bam_nt16_rev_table;
-
-extern char bam_nt16_nt4_table[];
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-	/*! @abstract TAM file handler */
-	typedef struct __tamFile_t * tamFile;
-
-	/*!
-	  @abstract   Open a SAM file for reading, either uncompressed or compressed by gzip/zlib.
-	  @param  fn  SAM file name
-	  @return     SAM file handler
-	 */
-	tamFile sam_open ( const char * fn );
-
-	/*!
-	  @abstract   Close a SAM file handler
-	  @param  fp  SAM file handler
-	 */
-	void sam_close ( tamFile fp );
-
-	/*!
-	  @abstract      Read one alignment from a SAM file handler
-	  @param  fp     SAM file handler
-	  @param  header header information (ordered names of chromosomes)
-	  @param  b      read alignment; all members in b will be updated
-	  @return        0 if successful; otherwise negative
-	 */
-	int sam_read1 ( tamFile fp, bam_header_t * header, bam1_t * b );
-
-	/*!
-	  @abstract       Read header information from a TAB-delimited list file.
-	  @param  fn_list file name for the list
-	  @return         a pointer to the header structure
-
-	  @discussion Each line in this file consists of chromosome name and
-	  the length of chromosome.
-	 */
-	bam_header_t * sam_header_read2 ( const char * fn_list );
-
-	/*!
-	  @abstract       Read header from a SAM file (if present)
-	  @param  fp      SAM file handler
-	  @return         pointer to header struct; 0 if no @SQ lines available
-	 */
-	bam_header_t * sam_header_read ( tamFile fp );
-
-	/*!
-	  @abstract       Parse @SQ lines a update a header struct
-	  @param  h       pointer to the header struct to be updated
-	  @return         number of target sequences
-
-	  @discussion bam_header_t::{n_targets,target_len,target_name} will
-	  be destroyed in the first place.
-	 */
-	int sam_header_parse ( bam_header_t * h );
-
-	/*!
-	  @abstract       Parse @RG lines a update a header struct
-	  @param  h       pointer to the header struct to be updated
-	  @return         number of @RG lines
-
-	  @discussion bam_header_t::rg2lib will be destroyed in the first
-	  place.
-	 */
-	int sam_header_parse_rg ( bam_header_t * h );
-
-#define sam_write1(header, b) bam_view1(header, b)
-
-	int bam_strmap_put ( void * strmap, const char * rg, const char * lib );
-	const char * bam_strmap_get ( const void * strmap, const char * rg );
-	void * bam_strmap_dup ( const void * );
-	void * bam_strmap_init();
-	void bam_strmap_destroy ( void * strmap );
-
-	/*!
-	  @abstract Initialize a header structure.
-	  @return   the pointer to the header structure
-
-	  @discussion This function also modifies the global variable
-	  bam_is_be.
-	 */
-	bam_header_t * bam_header_init();
-
-	/*!
-	  @abstract        Destroy a header structure.
-	  @param  header  pointer to the header
-	 */
-	void bam_header_destroy ( bam_header_t * header );
-
-	/*!
-	  @abstract   Read a header structure from BAM.
-	  @param  fp  BAM file handler, opened by bam_open()
-	  @return     pointer to the header structure
-
-	  @discussion The file position indicator must be placed at the
-	  beginning of the file. Upon success, the position indicator will
-	  be set at the start of the first alignment.
-	 */
-	bam_header_t * bam_header_read ( bamFile fp );
-
-	/*!
-	  @abstract      Write a header structure to BAM.
-	  @param  fp     BAM file handler
-	  @param  header pointer to the header structure
-	  @return        always 0 currently
-	 */
-	int bam_header_write ( bamFile fp, const bam_header_t * header );
-
-	/*!
-	  @abstract   Read an alignment from BAM.
-	  @param  fp  BAM file handler
-	  @param  b   read alignment; all members are updated.
-	  @return     number of bytes read from the file
-
-	  @discussion The file position indicator must be
-	  placed right before an alignment. Upon success, this function
-	  will set the position indicator to the start of the next
-	  alignment. This function is not affected by the machine
-	  endianness.
-	 */
-	int bam_read1 ( bamFile fp, bam1_t * b );
-
-	/*!
-	  @abstract Write an alignment to BAM.
-	  @param  fp       BAM file handler
-	  @param  c        pointer to the bam1_core_t structure
-	  @param  data_len total length of variable size data related to
-	                   the alignment
-	  @param  data     pointer to the concatenated data
-	  @return          number of bytes written to the file
-
-	  @discussion This function is not affected by the machine
-	  endianness.
-	 */
-	int bam_write1_core ( bamFile fp, const bam1_core_t * c, int data_len, uint8_t * data );
-
-	/*!
-	  @abstract   Write an alignment to BAM.
-	  @param  fp  BAM file handler
-	  @param  b   alignment to write
-	  @return     number of bytes written to the file
-
-	  @abstract It is equivalent to:
-	    bam_write1_core(fp, &b->core, b->data_len, b->data)
-	 */
-	int bam_write1 ( bamFile fp, const bam1_t * b );
-
-	/*! @function
-	  @abstract  Initiate a pointer to bam1_t struct
-	 */
-#define bam_init1() ((bam1_t*)calloc(1, sizeof(bam1_t)))
-
-	/*! @function
-	  @abstract  Free the memory allocated for an alignment.
-	  @param  b  pointer to an alignment
-	 */
-#define bam_destroy1(b) do {                    \
-		if (b) { free((b)->data); free(b); }    \
-	} while (0)
-
-	/*!
-	  @abstract       Format a BAM record in the SAM format
-	  @param  header  pointer to the header structure
-	  @param  b       alignment to print
-	  @return         a pointer to the SAM string
-	 */
-	char * bam_format1 ( const bam_header_t * header, const bam1_t * b );
-
-	char * bam_format1_core ( const bam_header_t * header, const bam1_t * b, int of );
-
-	const char * bam_get_library ( bam_header_t * header, const bam1_t * b );
-
-	/*! @typedef
-	  @abstract Structure for one alignment covering the pileup position.
-	  @field  b      pointer to the alignment
-	  @field  qpos   position of the read base at the pileup site, 0-based
-	  @field  indel  indel length; 0 for no indel, positive for ins and negative for del
-	  @field  is_del 1 iff the base on the padded read is a deletion
-	  @field  level  the level of the read in the "viewer" mode
-
-	  @discussion See also bam_plbuf_push() and bam_lplbuf_push(). The
-	  difference between the two functions is that the former does not
-	  set bam_pileup1_t::level, while the later does. Level helps the
-	  implementation of alignment viewers, but calculating this has some
-	  overhead.
-	 */
-	typedef struct
-	{
-		bam1_t * b;
-		int32_t qpos;
-		int indel, level;
-		uint32_t is_del: 1, is_head: 1, is_tail: 1;
-	} bam_pileup1_t;
-
-	struct __bam_plbuf_t;
-	/*! @abstract pileup buffer */
-	typedef struct __bam_plbuf_t bam_plbuf_t;
-
-	void bam_plbuf_set_mask ( bam_plbuf_t * buf, int mask );
-
-	/*! @typedef
-	  @abstract    Type of function to be called by bam_plbuf_push().
-	  @param  tid  chromosome ID as is defined in the header
-	  @param  pos  start coordinate of the alignment, 0-based
-	  @param  n    number of elements in pl array
-	  @param  pl   array of alignments
-	  @param  data user provided data
-	  @discussion  See also bam_plbuf_push(), bam_plbuf_init() and bam_pileup1_t.
-	 */
-	typedef int ( *bam_pileup_f ) ( uint32_t tid, uint32_t pos, int n, const bam_pileup1_t * pl, void * data );
-
-	/*!
-	  @abstract     Reset a pileup buffer for another pileup process
-	  @param  buf   the pileup buffer to be reset
-	 */
-	void bam_plbuf_reset ( bam_plbuf_t * buf );
-
-	/*!
-	  @abstract     Initialize a buffer for pileup.
-	  @param  func  fucntion to be called by bam_pileup_core()
-	  @param  data  user provided data
-	  @return       pointer to the pileup buffer
-	 */
-	bam_plbuf_t * bam_plbuf_init ( bam_pileup_f func, void * data );
-
-	/*!
-	  @abstract    Destroy a pileup buffer.
-	  @param  buf  pointer to the pileup buffer
-	 */
-	void bam_plbuf_destroy ( bam_plbuf_t * buf );
-
-	/*!
-	  @abstract    Push an alignment to the pileup buffer.
-	  @param  b    alignment to be pushed
-	  @param  buf  pileup buffer
-	  @see         bam_plbuf_init()
-	  @return      always 0 currently
-
-	  @discussion If all the alignments covering a particular site have
-	  been collected, this function will call the user defined function
-	  as is provided to bam_plbuf_init(). The coordinate of the site and
-	  all the alignments will be transferred to the user defined
-	  function as function parameters.
-
-	  When all the alignments are pushed to the buffer, this function
-	  needs to be called with b equal to NULL. This will flush the
-	  buffer. A pileup buffer can only be reused when bam_plbuf_reset()
-	  is called.
-	 */
-	int bam_plbuf_push ( const bam1_t * b, bam_plbuf_t * buf );
-
-	int bam_pileup_file ( bamFile fp, int mask, bam_pileup_f func, void * func_data );
-
-	struct __bam_lplbuf_t;
-	typedef struct __bam_lplbuf_t bam_lplbuf_t;
-
-	void bam_lplbuf_reset ( bam_lplbuf_t * buf );
-
-	/*! @abstract  bam_plbuf_init() equivalent with level calculated. */
-	bam_lplbuf_t * bam_lplbuf_init ( bam_pileup_f func, void * data );
-
-	/*! @abstract  bam_plbuf_destroy() equivalent with level calculated. */
-	void bam_lplbuf_destroy ( bam_lplbuf_t * tv );
-
-	/*! @abstract  bam_plbuf_push() equivalent with level calculated. */
-	int bam_lplbuf_push ( const bam1_t * b, bam_lplbuf_t * buf );
-
-	struct __bam_index_t;
-	typedef struct __bam_index_t bam_index_t;
-
-	/*!
-	  @abstract   Build index for a BAM file.
-	  @discussion Index file "fn.bai" will be created.
-	  @param  fn  name of the BAM file
-	  @return     always 0 currently
-	 */
-	int bam_index_build ( const char * fn );
-
-	/*!
-	  @abstract   Load index from file "fn.bai".
-	  @param  fn  name of the BAM file (NOT the index file)
-	  @return     pointer to the index structure
-	 */
-	bam_index_t * bam_index_load ( const char * fn );
-
-	/*!
-	  @abstract    Destroy an index structure.
-	  @param  idx  pointer to the index structure
-	 */
-	void bam_index_destroy ( bam_index_t * idx );
-
-	/*! @typedef
-	  @abstract      Type of function to be called by bam_fetch().
-	  @param  b     the alignment
-	  @param  data  user provided data
-	 */
-	typedef int ( *bam_fetch_f ) ( const bam1_t * b, void * data );
-
-	/*!
-	  @abstract Retrieve the alignments that are overlapped with the
-	  specified region.
-
-	  @discussion A user defined function will be called for each
-	  retrieved alignment ordered by its start position.
-
-	  @param  fp    BAM file handler
-	  @param  idx   pointer to the alignment index
-	  @param  tid   chromosome ID as is defined in the header
-	  @param  beg   start coordinate, 0-based
-	  @param  end   end coordinate, 0-based
-	  @param  data  user provided data (will be transferred to func)
-	  @param  func  user defined function
-	 */
-	int bam_fetch ( bamFile fp, const bam_index_t * idx, int tid, int beg, int end, void * data, bam_fetch_f func );
-
-	/*!
-	  @abstract       Parse a region in the format: "chr2:100,000-200,000".
-	  @discussion     bam_header_t::hash will be initialized if empty.
-	  @param  header  pointer to the header structure
-	  @param  str     string to be parsed
-	  @param  ref_id  the returned chromosome ID
-	  @param  begin   the returned start coordinate
-	  @param  end     the returned end coordinate
-	  @return         0 on success; -1 on failure
-	 */
-	int bam_parse_region ( bam_header_t * header, const char * str, int * ref_id, int * begin, int * end );
-
-	/*!
-	  @abstract       Retrieve data of a tag
-	  @param  b       pointer to an alignment struct
-	  @param  tag     two-character tag to be retrieved
-
-	  @return  pointer to the type and data. The first character is the
-	  type that can be 'iIsScCdfAZH'.
-
-	  @discussion  Use bam_aux2?() series to convert the returned data to
-	  the corresponding type.
-	*/
-	uint8_t * bam_aux_get ( const bam1_t * b, const char tag[2] );
-
-	int32_t bam_aux2i ( const uint8_t * s );
-	float bam_aux2f ( const uint8_t * s );
-	double bam_aux2d ( const uint8_t * s );
-	char bam_aux2A ( const uint8_t * s );
-	char * bam_aux2Z ( const uint8_t * s );
-
-	int bam_aux_del ( bam1_t * b, uint8_t * s );
-	void bam_aux_append ( bam1_t * b, const char tag[2], char type, int len, uint8_t * data );
-	uint8_t * bam_aux_get_core ( bam1_t * b, const char tag[2] ); // an alias of bam_aux_get()
-
-	/*!
-	  @abstract Calculate the rightmost coordinate of an alignment on the
-	  reference genome.
-
-	  @param  c      pointer to the bam1_core_t structure
-	  @param  cigar  the corresponding CIGAR array (from bam1_t::cigar)
-	  @return        the rightmost coordinate, 0-based
-	*/
-	uint32_t bam_calend ( const bam1_core_t * c, const uint32_t * cigar );
-
-	/*!
-	  @abstract      Calculate the length of the query sequence from CIGAR.
-	  @param  c      pointer to the bam1_core_t structure
-	  @param  cigar  the corresponding CIGAR array (from bam1_t::cigar)
-	  @return        length of the query sequence
-	*/
-	int32_t bam_cigar2qlen ( const bam1_core_t * c, const uint32_t * cigar );
-
-#ifdef __cplusplus
-}
-#endif
-
-/*!
-  @abstract    Calculate the minimum bin that contains a region [beg,end).
-  @param  beg  start of the region, 0-based
-  @param  end  end of the region, 0-based
-  @return      bin
- */
-static inline int bam_reg2bin ( uint32_t beg, uint32_t end )
-{
-	--end;
-
-	if ( beg >> 14 == end >> 14 ) { return 4681 + ( beg >> 14 ); }
-
-	if ( beg >> 17 == end >> 17 ) { return  585 + ( beg >> 17 ); }
-
-	if ( beg >> 20 == end >> 20 ) { return   73 + ( beg >> 20 ); }
-
-	if ( beg >> 23 == end >> 23 ) { return    9 + ( beg >> 23 ); }
-
-	if ( beg >> 26 == end >> 26 ) { return    1 + ( beg >> 26 ); }
-
-	return 0;
-}
-
-/*!
-  @abstract     Copy an alignment
-  @param  bdst  destination alignment struct
-  @param  bsrc  source alignment struct
-  @return       pointer to the destination alignment struct
- */
-static inline bam1_t * bam_copy1 ( bam1_t * bdst, const bam1_t * bsrc )
-{
-	uint8_t * data = bdst->data;
-	int m_data = bdst->m_data;   // backup data and m_data
-
-	if ( m_data < bsrc->m_data ) // double the capacity
-	{
-		m_data = bsrc->m_data;
-		kroundup32 ( m_data );
-		data = ( uint8_t * ) realloc ( data, m_data );
-	}
-
-	memcpy ( data, bsrc->data, bsrc->data_len ); // copy var-len data
-	*bdst = *bsrc; // copy the rest
-	// restore the backup
-	bdst->m_data = m_data;
-	bdst->data = data;
-	return bdst;
-}
-
-/*!
-  @abstract     Duplicate an alignment
-  @param  src   source alignment struct
-  @return       pointer to the destination alignment struct
- */
-static inline bam1_t * bam_dup1 ( const bam1_t * src )
-{
-	bam1_t * b;
-	b = bam_init1();
-	*b = *src;
-	b->m_data = b->data_len;
-	b->data = ( uint8_t * ) calloc ( b->data_len, 1 );
-	memcpy ( b->data, src->data, b->data_len );
-	return b;
-}
-
-#endif
diff --git a/sparsePregraph/inc/bgzf.h b/sparsePregraph/inc/bgzf.h
deleted file mode 100644
index 85bb2d4..0000000
--- a/sparsePregraph/inc/bgzf.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* The MIT License
-
-   Copyright (c) 2008 Broad Institute / Massachusetts Institute of Technology
-
-   Permission is hereby granted, free of charge, to any person obtaining a copy
-   of this software and associated documentation files (the "Software"), to deal
-   in the Software without restriction, including without limitation the rights
-   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-   copies of the Software, and to permit persons to whom the Software is
-   furnished to do so, subject to the following conditions:
-
-   The above copyright notice and this permission notice shall be included in
-   all copies or substantial portions of the Software.
-
-   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-   THE SOFTWARE.
-*/
-
-#ifndef __BGZF_H
-#define __BGZF_H
-
-#include <stdint.h>
-#include <stdio.h>
-//#include <stdbool.h>
-#include <zlib.h>
-#ifdef _USE_KNETFILE
-#include "knetfile.h"
-#endif
-
-//typedef int8_t bool;
-
-typedef struct
-{
-	int file_descriptor;
-	char open_mode;  // 'r' or 'w'
-	bool owned_file, is_uncompressed;
-#ifdef _USE_KNETFILE
-	union
-	{
-		knetFile * fpr;
-		FILE * fpw;
-	} x;
-#else
-	FILE * file;
-#endif
-	int uncompressed_block_size;
-	int compressed_block_size;
-	void * uncompressed_block;
-	void * compressed_block;
-	int64_t block_address;
-	int block_length;
-	int block_offset;
-	int cache_size;
-	const char * error;
-	void * cache; // a pointer to a hash table
-} BGZF;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-	/*
-	 * Open an existing file descriptor for reading or writing.
-	 * Mode must be either "r" or "w".
-	 * A subsequent bgzf_close will not close the file descriptor.
-	 * Returns null on error.
-	 */
-	BGZF * bgzf_fdopen ( int fd, const char * __restrict mode );
-
-	/*
-	 * Open the specified file for reading or writing.
-	 * Mode must be either "r" or "w".
-	 * Returns null on error.
-	 */
-	BGZF * bgzf_open ( const char * path, const char * __restrict mode );
-
-	/*
-	 * Close the BGZ file and free all associated resources.
-	 * Does not close the underlying file descriptor if created with bgzf_fdopen.
-	 * Returns zero on success, -1 on error.
-	 */
-	int bgzf_close ( BGZF * fp );
-
-	/*
-	 * Read up to length bytes from the file storing into data.
-	 * Returns the number of bytes actually read.
-	 * Returns zero on end of file.
-	 * Returns -1 on error.
-	 */
-	int bgzf_read ( BGZF * fp, void * data, int length );
-
-	/*
-	 * Write length bytes from data to the file.
-	 * Returns the number of bytes written.
-	 * Returns -1 on error.
-	 */
-	int bgzf_write ( BGZF * fp, const void * data, int length );
-
-	/*
-	 * Return a virtual file pointer to the current location in the file.
-	 * No interpetation of the value should be made, other than a subsequent
-	 * call to bgzf_seek can be used to position the file at the same point.
-	 * Return value is non-negative on success.
-	 * Returns -1 on error.
-	 */
-	int64_t bgzf_tell ( BGZF * fp );
-
-	/*
-	 * Set the file to read from the location specified by pos, which must
-	 * be a value previously returned by bgzf_tell for this file (but not
-	 * necessarily one returned by this file handle).
-	 * The where argument must be SEEK_SET.
-	 * Seeking on a file opened for write is not supported.
-	 * Returns zero on success, -1 on error.
-	 */
-	int64_t bgzf_seek ( BGZF * fp, int64_t pos, int where );
-
-	/*
-	 * Set the cache size. Zero to disable. By default, caching is
-	 * disabled. The recommended cache size for frequent random access is
-	 * about 8M bytes.
-	 */
-	void bgzf_set_cache_size ( BGZF * fp, int cache_size );
-
-	int bgzf_check_EOF ( BGZF * fp );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sparsePregraph/inc/global.h b/sparsePregraph/inc/global.h
index 59f78b9..eebaeca 100644
--- a/sparsePregraph/inc/global.h
+++ b/sparsePregraph/inc/global.h
@@ -45,7 +45,7 @@ extern uint64_t GenomeSize;
 extern int solve; // solve reapeat or not
 extern int run_mode;
 
-extern int thrd_num;
+extern int thrd_num_s;
 
 extern size_t * edge_cnt_total ; //used int lock strategy
 extern size_t * bucket_count_total ; //used in lock strategy
diff --git a/sparsePregraph/inc/sam.h b/sparsePregraph/inc/sam.h
deleted file mode 100644
index 26e7a1e..0000000
--- a/sparsePregraph/inc/sam.h
+++ /dev/null
@@ -1,100 +0,0 @@
-#ifndef BAM_SAM_H
-#define BAM_SAM_H
-
-#include "bam.h"
-
-/*!
-  @header
-
-  This file provides higher level of I/O routines and unifies the APIs
-  for SAM and BAM formats. These APIs are more convenient and
-  recommended.
-
-  @copyright Genome Research Ltd.
- */
-
-/*! @typedef
-  @abstract SAM/BAM file handler
-  @field  type    type of the handler; bit 1 for BAM, 2 for reading and bit 3-4 for flag format
-  @field  bam   BAM file handler; valid if (type&1) == 1
-  @field  tamr  SAM file handler for reading; valid if type == 2
-  @field  tamw  SAM file handler for writing; valid if type == 0
-  @field  header  header struct
- */
-typedef struct
-{
-	int type;
-	union
-	{
-		tamFile tamr;
-		bamFile bam;
-		FILE * tamw;
-	} x;
-	bam_header_t * header;
-} samfile_t;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-	/*!
-	  @abstract     Open a SAM/BAM file
-
-	  @param fn SAM/BAM file name; "-" is recognized as stdin (for
-	  reading) or stdout (for writing).
-
-	  @param mode open mode /[rw](b?)(u?)(h?)([xX]?)/: 'r' for reading,
-	  'w' for writing, 'b' for BAM I/O, 'u' for uncompressed BAM output,
-	  'h' for outputing header in SAM, 'x' for HEX flag and 'X' for
-	  string flag. If 'b' present, it must immediately follow 'r' or
-	  'w'. Valid modes are "r", "w", "wh", "wx", "whx", "wX", "whX",
-	  "rb", "wb" and "wbu" exclusively.
-
-	  @param aux auxiliary data; if mode[0]=='w', aux points to
-	  bam_header_t; if strcmp(mode, "rb")!=0 and @SQ header lines in SAM
-	  are absent, aux points the file name of the list of the reference;
-	  aux is not used otherwise. If @SQ header lines are present in SAM,
-	  aux is not used, either.
-
-	  @return       SAM/BAM file handler
-	 */
-	samfile_t * samopen ( const char * fn, const char * mode, const void * aux );
-
-	/*!
-	  @abstract     Close a SAM/BAM handler
-	  @param  fp    file handler to be closed
-	 */
-	void samclose ( samfile_t * fp );
-
-	/*!
-	  @abstract     Read one alignment
-	  @param  fp    file handler
-	  @param  b     alignment
-	  @return       bytes read
-	 */
-	int samread ( samfile_t * fp, bam1_t * b );
-
-	/*!
-	  @abstract     Write one alignment
-	  @param  fp    file handler
-	  @param  b     alignment
-	  @return       bytes written
-	 */
-	int samwrite ( samfile_t * fp, const bam1_t * b );
-
-	/*!
-	  @abstract     Get the pileup for a whole alignment file
-	  @param  fp    file handler
-	  @param  mask  mask transferred to bam_plbuf_set_mask()
-	  @param  func  user defined function called in the pileup process
-	  #param  data  user provided data for func()
-	 */
-	int sampileup ( samfile_t * fp, int mask, bam_pileup_f func, void * data );
-
-	char * samfaipath ( const char * fn_ref );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sparsePregraph/inc/spinLock.h b/sparsePregraph/inc/spinLock.h
deleted file mode 100644
index 836f6b7..0000000
--- a/sparsePregraph/inc/spinLock.h
+++ /dev/null
@@ -1,40 +0,0 @@
-typedef int pthread_spinlock_t;
-#ifndef EBUSY
-#define EBUSY 16
-#endif
-
-static inline int pthread_spin_init(pthread_spinlock_t *lock, int pshared) {
-    __asm__ __volatile__ ("" ::: "memory");
-    *lock = 0;
-    return 0;
-}
-
-static inline int pthread_spin_destroy(pthread_spinlock_t *lock) {
-    return 0;
-}
-
-static inline int pthread_spin_lock(pthread_spinlock_t *lock) {
-    while (1) {
-        int i;
-        for (i=0; i < 10000; i++) {
-            if (__sync_bool_compare_and_swap(lock, 0, 1)) {
-                return 0;
-            }
-        }
-        sched_yield();
-    }
-}
-
-static inline int pthread_spin_trylock(pthread_spinlock_t *lock) {
-    if (__sync_bool_compare_and_swap(lock, 0, 1)) {
-        return 0;
-    }
-    return (EBUSY);
-}
-
-static inline int pthread_spin_unlock(pthread_spinlock_t *lock) {
-    __asm__ __volatile__ ("" ::: "memory");
-    *lock = 0;
-    return 0;
-}
-
diff --git a/sparsePregraph/inc/xcurses.h.gch b/sparsePregraph/inc/xcurses.h.gch
new file mode 100644
index 0000000..e01c34a
Binary files /dev/null and b/sparsePregraph/inc/xcurses.h.gch differ
diff --git a/sparsePregraph/inc/zconf.h b/sparsePregraph/inc/zconf.h
deleted file mode 100644
index bdb26f5..0000000
--- a/sparsePregraph/inc/zconf.h
+++ /dev/null
@@ -1,332 +0,0 @@
-/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#ifndef ZCONF_H
-#define ZCONF_H
-
-/*
- * If you *really* need a unique prefix for all types and library functions,
- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
- */
-#ifdef Z_PREFIX
-#  define deflateInit_          z_deflateInit_
-#  define deflate               z_deflate
-#  define deflateEnd            z_deflateEnd
-#  define inflateInit_          z_inflateInit_
-#  define inflate               z_inflate
-#  define inflateEnd            z_inflateEnd
-#  define deflateInit2_         z_deflateInit2_
-#  define deflateSetDictionary  z_deflateSetDictionary
-#  define deflateCopy           z_deflateCopy
-#  define deflateReset          z_deflateReset
-#  define deflateParams         z_deflateParams
-#  define deflateBound          z_deflateBound
-#  define deflatePrime          z_deflatePrime
-#  define inflateInit2_         z_inflateInit2_
-#  define inflateSetDictionary  z_inflateSetDictionary
-#  define inflateSync           z_inflateSync
-#  define inflateSyncPoint      z_inflateSyncPoint
-#  define inflateCopy           z_inflateCopy
-#  define inflateReset          z_inflateReset
-#  define inflateBack           z_inflateBack
-#  define inflateBackEnd        z_inflateBackEnd
-#  define compress              z_compress
-#  define compress2             z_compress2
-#  define compressBound         z_compressBound
-#  define uncompress            z_uncompress
-#  define adler32               z_adler32
-#  define crc32                 z_crc32
-#  define get_crc_table         z_get_crc_table
-#  define zError                z_zError
-
-#  define alloc_func            z_alloc_func
-#  define free_func             z_free_func
-#  define in_func               z_in_func
-#  define out_func              z_out_func
-#  define Byte                  z_Byte
-#  define uInt                  z_uInt
-#  define uLong                 z_uLong
-#  define Bytef                 z_Bytef
-#  define charf                 z_charf
-#  define intf                  z_intf
-#  define uIntf                 z_uIntf
-#  define uLongf                z_uLongf
-#  define voidpf                z_voidpf
-#  define voidp                 z_voidp
-#endif
-
-#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 0           /* HAVE_UNISTD_H -- this line is updated by ./configure */
-#  include <sys/types.h> /* for off_t */
-#  include <unistd.h>    /* for SEEK_* and off_t */
-#  ifdef VMS
-#    include <unixio.h>   /* for off_t */
-#  endif
-#  define z_off_t off_t
-#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(__OS400__)
-#  define NO_vsnprintf
-#endif
-
-#if defined(__MVS__)
-#  define NO_vsnprintf
-#  ifdef FAR
-#    undef FAR
-#  endif
-#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/sparsePregraph/inc/zlib.h b/sparsePregraph/inc/zlib.h
deleted file mode 100644
index 326df1a..0000000
--- a/sparsePregraph/inc/zlib.h
+++ /dev/null
@@ -1,1359 +0,0 @@
-/* zlib.h -- interface of the 'zlib' general purpose compression library
-  version 1.2.3, July 18th, 2005
-
-  Copyright (C) 1995-2005 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.3"
-#define ZLIB_VERNUM 0x1230
-
-	/*
-	     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 (for example if an input file is mmap'ed), 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 /* will be removed, use Z_SYNC_FLUSH instead */
-#define Z_SYNC_FLUSH    2
-#define Z_FULL_FLUSH    3
-#define Z_FINISH        4
-#define Z_BLOCK         5
-	/* 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,
-	   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 accumualte 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.
-
-	    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 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.  msg is set to null if there is no error
-	   message. inflateInit does not perform any decompression apart from reading
-	   the zlib header if present: this will be done by inflate().  (So next_in and
-	   avail_in may be modified, but next_out and avail_out are unchanged.)
-	*/
-
-
-	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, or Z_BLOCK. 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.
-
-	    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 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() will decompress and check either zlib-wrapped or gzip-wrapped
-	  deflate data.  The header type is detected automatically.  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
-	  if next_in or next_out was 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 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 a parameter is invalid (such as an invalid
-	   method). 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 in
-	   deflate or deflate2. 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 (such as NULL dictionary) 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 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 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().  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 -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_STREAM_ERROR if a parameter is invalid (such as a null strm). msg
-	   is set to null if there is no error message.  inflateInit2 does not perform
-	   any decompression apart from reading the zlib header if present: this will
-	   be done by inflate(). (So next_in and avail_in may be modified, but next_out
-	   and avail_out are unchanged.)
-	*/
-
-	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 (such as NULL dictionary) 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 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 NULL).
-	*/
-
-	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.
-
-	      inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the 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 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 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 easily 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.
-	     This function can be used to compress a whole file at once if the
-	   input file is mmap'ed.
-	     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 compressed buffer.
-	     This function can be used to decompress a whole file at once if the
-	   input file is mmap'ed.
-
-	     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.
-	*/
-
-
-	typedef voidp gzFile;
-
-	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", or 'R' for run-length encoding
-	   as in "wb1R". (See the description of deflateInit2 for more information
-	   about the strategy parameter.)
-
-	     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 or if there was
-	   insufficient memory to allocate the (de)compression state; errno
-	   can be checked to distinguish the two cases (if errno is zero, the
-	   zlib error is Z_MEM_ERROR).  */
-
-	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 (in 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 gzdopen(dup(fd), mode).
-	     gzdopen returns NULL if there was insufficient memory to allocate
-	   the (de)compression state.
-	*/
-
-	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.
-	     gzread returns the number of uncompressed bytes actually read (0 for
-	   end of file, -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 actually written
-	   (0 in case of error).
-	*/
-
-	ZEXTERN int ZEXPORTVA   gzprintf OF ( ( gzFile file, const char * format, ... ) );
-	/*
-	     Converts, formats, and writes the args to the compressed file under
-	   control of the format string, as in fprintf. gzprintf returns the number of
-	   uncompressed bytes actually written (0 in case of error).  The number of
-	   uncompressed bytes written is limited to 4095. The caller should assure that
-	   this limit is not exceeded. If it is exceeded, then gzprintf() will return
-	   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.
-	*/
-
-	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.  The string is then terminated with a null
-	   character.
-	      gzgets returns buf, or Z_NULL in case of error.
-	*/
-
-	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 again later.
-	   Only one character of push-back is allowed.  gzungetc() returns the
-	   character pushed, or -1 on failure.  gzungetc() will fail if a
-	   character has been pushed but not read yet, or if c is -1. 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 returns Z_OK if
-	   the flush parameter is Z_FINISH and all output could be flushed.
-	     gzflush should be called only when strictly necessary because it can
-	   degrade compression.
-	*/
-
-	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.
-
-	   gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
-	*/
-
-	ZEXTERN int ZEXPORT gzeof OF ( ( gzFile file ) );
-	/*
-	     Returns 1 when EOF has previously been detected reading the given
-	   input stream, otherwise zero.
-	*/
-
-	ZEXTERN int ZEXPORT gzdirect OF ( ( gzFile file ) );
-	/*
-	     Returns 1 if file is being read directly without decompression, otherwise
-	   zero.
-	*/
-
-	ZEXTERN int ZEXPORT    gzclose OF ( ( gzFile file ) );
-	/*
-	     Flushes all pending output if necessary, closes the compressed file
-	   and deallocates all the (de)compression state. The return value is the zlib
-	   error number (see function gzerror below).
-	*/
-
-	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.
-	*/
-
-	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 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 new_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 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))
-
-
-#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
-	struct internal_state {int dummy;}; /* hack for buggy compilers */
-#endif
-
-	ZEXTERN const char  *  ZEXPORT zError           OF ( ( int ) );
-	ZEXTERN int            ZEXPORT inflateSyncPoint OF ( ( z_streamp z ) );
-	ZEXTERN const uLongf * ZEXPORT get_crc_table    OF ( ( void ) );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ZLIB_H */
diff --git a/sparsePregraph/main.cpp b/sparsePregraph/main.cpp
new file mode 100644
index 0000000..cd65a85
--- /dev/null
+++ b/sparsePregraph/main.cpp
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+extern "C" int call_pregraph_sparse ( int argc, char ** argv );
+
+int main ( int argc, char ** argv )
+{
+        fprintf ( stderr, "\nVersion 1.0.3: released on July 13th, 2012\nCompile %s\t%s\n\n", __DATE__, __TIME__ );
+        call_pregraph_sparse ( argc, argv );
+}
+
diff --git a/sparsePregraph/multi_threads.cpp b/sparsePregraph/multi_threads.cpp
index e46d0ad..6808834 100644
--- a/sparsePregraph/multi_threads.cpp
+++ b/sparsePregraph/multi_threads.cpp
@@ -32,7 +32,7 @@ void creatThrds ( pthread_t * threads, PARAMETER * paras )
 	unsigned char i;
 	int temp;
 
-	for ( i = 0; i < thrd_num; i++ )
+	for ( i = 0; i < thrd_num_s; i++ )
 	{
 		if ( ( temp = pthread_create ( &threads[i], NULL, threadRoutine, & ( paras[i] ) ) ) != 0 )
 		{
@@ -41,8 +41,8 @@ void creatThrds ( pthread_t * threads, PARAMETER * paras )
 		}
 	}
 
-	//fprintf(stderr,"%d work threads created.\n",thrd_num);
-	fprintf ( stderr, "%d work threads initialized.\n", thrd_num );
+	//fprintf(stderr,"%d work threads created.\n",thrd_num_s);
+	fprintf ( stderr, "%d work threads initialized.\n", thrd_num_s );
 }
 
 
@@ -67,17 +67,17 @@ void * threadRoutine ( void * para )
 		}
 		else if ( * ( prm->selfSignal ) == 10 )
 		{
-			run_process_threaded ( ht, locks, K_size, gap, read_num, thrd_num, prm->threadID, 1 );
+			run_process_threaded ( ht, locks, K_size, gap, read_num, thrd_num_s, prm->threadID, 1 );
 			* ( prm->selfSignal ) = 0;
 		}
 		else if ( * ( prm->selfSignal ) == 11 )
 		{
-			run_process_threaded ( ht, locks, K_size, gap, read_num, thrd_num, prm->threadID, 2 );
+			run_process_threaded ( ht, locks, K_size, gap, read_num, thrd_num_s, prm->threadID, 2 );
 			* ( prm->selfSignal ) = 0;
 		}
 		else if ( * ( prm->selfSignal ) == 12 )
 		{
-			for ( int i = prm->threadID ; i < read_num; i += thrd_num )
+			for ( int i = prm->threadID ; i < read_num; i += thrd_num_s )
 			{
 				int bad_flag = 0;
 				filter_N ( seq_t[i], bad_flag );
@@ -98,7 +98,7 @@ void thread_wait ( pthread_t * threads )
 {
 	int i;
 
-	for ( i = 0; i < thrd_num; i++ )
+	for ( i = 0; i < thrd_num_s; i++ )
 		if ( threads[i] != 0 )
 			{ pthread_join ( threads[i], NULL ); }
 }
@@ -107,18 +107,18 @@ void sendWorkSignal ( unsigned char SIG, unsigned char * thrdSignals )
 {
 	int t;
 
-	for ( t = 0; t < thrd_num; t++ )
+	for ( t = 0; t < thrd_num_s; t++ )
 		{ thrdSignals[t + 1] = SIG; }
 
 	while ( 1 )
 	{
 		usleep ( 10 );
 
-		for ( t = 0; t < thrd_num; t++ )
+		for ( t = 0; t < thrd_num_s; t++ )
 			if ( thrdSignals[t + 1] )
 				{ break; }
 
-		if ( t == thrd_num )
+		if ( t == thrd_num_s )
 			{ break; }
 	}
 }
diff --git a/sparsePregraph/pregraph_sparse.cpp b/sparsePregraph/pregraph_sparse.cpp
index 525bfc0..53b687e 100644
--- a/sparsePregraph/pregraph_sparse.cpp
+++ b/sparsePregraph/pregraph_sparse.cpp
@@ -36,16 +36,17 @@
 static int LOAD_GRAPH = 0, BUILD_DBG = 1, BUILD_EDGES = 1, BUILD_PREARCS = 1;
 //static    int run_mode=0;
 
-int call_pregraph_sparse ( int argc, char ** argv );
+extern "C" int call_pregraph_sparse ( int argc, char ** argv );
 static void initenv ( int argc, char ** argv );
 static void parse_args ( vector<string> &in_filenames_vt );
 static void display_pregraph_usage();
 
+/*
 int main ( int argc, char ** argv )
 {
 	fprintf ( stderr, "\nVersion 1.0.3: released on July 13th, 2012\nCompile %s\t%s\n\n", __DATE__, __TIME__ );
 	call_pregraph_sparse ( argc, argv );
-}
+}*/
 
 
 
@@ -73,7 +74,7 @@ Output:
 Return:
     None.
 *************************************************/
-int call_pregraph_sparse ( int argc, char ** argv )
+extern "C" int call_pregraph_sparse ( int argc, char ** argv )
 {
 	time_t all_beg_time, all_end_time;
 	time ( &all_beg_time );
@@ -108,7 +109,7 @@ int call_pregraph_sparse ( int argc, char ** argv )
 				}
 
 				hashTableSZ = ( size_t ) GenomeSize / max ( gap - 1, 5 );
-				int read_buf_sz = 102400 * thrd_num;
+				int read_buf_sz = 102400 * thrd_num_s;
 				Init_HT2 ( &ht2, hashTableSZ );
 				//create main io thread
 				read_buf0 = new string[read_buf_sz];
@@ -131,9 +132,9 @@ int call_pregraph_sparse ( int argc, char ** argv )
 
 				fprintf ( stderr, "1 io thread initialized.\n" );
 				//create work threads  for round 1
-				pthread_t threads[thrd_num];
-				unsigned char thrdSignal[thrd_num + 1];
-				PARAMETER paras[thrd_num];
+				pthread_t threads[thrd_num_s];
+				unsigned char thrdSignal[thrd_num_s + 1];
+				PARAMETER paras[thrd_num_s];
 				locks = ( pthread_spinlock_t * ) calloc ( ht2.ht_sz, sizeof ( pthread_spinlock_t ) );
 
 				//initialize the locks  unlock
@@ -144,10 +145,10 @@ int call_pregraph_sparse ( int argc, char ** argv )
 
 				//create threads
 				//fprintf(stderr,"Creating work threads ...\n");
-				bucket_count_total = ( size_t * ) calloc ( thrd_num, sizeof ( size_t ) );
-				edge_cnt_total = ( size_t * ) calloc ( thrd_num, sizeof ( size_t ) );
+				bucket_count_total = ( size_t * ) calloc ( thrd_num_s, sizeof ( size_t ) );
+				edge_cnt_total = ( size_t * ) calloc ( thrd_num_s, sizeof ( size_t ) );
 
-				for ( int k = 0; k < thrd_num; k++ )
+				for ( int k = 0; k < thrd_num_s; k++ )
 				{
 					thrdSignal[k + 1] = 0;
 					paras[k].threadID = k;
@@ -174,7 +175,7 @@ int call_pregraph_sparse ( int argc, char ** argv )
 						processed_reads += read_num;
 						sendWorkSignal ( 10, thrdSignal );
 
-						for ( int k1 = 0; k1 < thrd_num; ++k1 )
+						for ( int k1 = 0; k1 < thrd_num_s; ++k1 )
 						{
 							bucket_count += bucket_count_total[k1];
 							bucket_count_total[k1] = 0;
@@ -221,7 +222,7 @@ int call_pregraph_sparse ( int argc, char ** argv )
 				time ( &beg_time );
 				edge_cnt = 0;
 				//create main io thread
-				int read_buf_sz = 102400 * thrd_num;
+				int read_buf_sz = 102400 * thrd_num_s;
 				read_buf0 = new string[read_buf_sz];
 				read_buf1 = new string[read_buf_sz];
 				io_stat0 = 1; //must be one, if io_stat0 =0 ,the io thread will work immediately
@@ -242,9 +243,9 @@ int call_pregraph_sparse ( int argc, char ** argv )
 
 				fprintf ( stderr, "1 io thread initialized.\n" );
 				//create work threads  for round 2
-				pthread_t threads[thrd_num];
-				unsigned char thrdSignal[thrd_num + 1];
-				PARAMETER paras[thrd_num];
+				pthread_t threads[thrd_num_s];
+				unsigned char thrdSignal[thrd_num_s + 1];
+				PARAMETER paras[thrd_num_s];
 				locks = ( pthread_spinlock_t * ) calloc ( ht2.ht_sz, sizeof ( pthread_spinlock_t ) );
 
 				//initialize locks unlock
@@ -255,10 +256,10 @@ int call_pregraph_sparse ( int argc, char ** argv )
 
 				//create threads
 				//fprintf(stderr,"Creating work threads ...\n");
-				bucket_count_total = ( size_t * ) calloc ( thrd_num, sizeof ( size_t ) );
-				edge_cnt_total = ( size_t * ) calloc ( thrd_num, sizeof ( size_t ) );
+				bucket_count_total = ( size_t * ) calloc ( thrd_num_s, sizeof ( size_t ) );
+				edge_cnt_total = ( size_t * ) calloc ( thrd_num_s, sizeof ( size_t ) );
 
-				for ( int k = 0; k < thrd_num; k++ )
+				for ( int k = 0; k < thrd_num_s; k++ )
 				{
 					thrdSignal[k + 1] = 0;
 					paras[k].threadID = k;
@@ -288,7 +289,7 @@ int call_pregraph_sparse ( int argc, char ** argv )
 						processed_reads += read_num;
 						sendWorkSignal ( 11, thrdSignal );
 
-						for ( int k1 = 0; k1 < thrd_num; ++k1 )
+						for ( int k1 = 0; k1 < thrd_num_s; ++k1 )
 						{
 							edge_cnt += edge_cnt_total[k1];
 							edge_cnt_total[k1] = 0;
@@ -429,9 +430,9 @@ int call_pregraph_sparse ( int argc, char ** argv )
 			}
 
 			/*buffers for seperate threads*/
-			path_buffer = ( edge_path_buffer ** ) calloc ( thrd_num, sizeof ( edge_path_buffer ) );
+			path_buffer = ( edge_path_buffer ** ) calloc ( thrd_num_s, sizeof ( edge_path_buffer ) );
 
-			for ( int i = 0; i < thrd_num; i++ )
+			for ( int i = 0; i < thrd_num_s; i++ )
 			{
 				path_buffer[i] = create_edge_path_buffer ( mark_on_edge, s_locks, buff_size, max_path_length );
 			}
@@ -445,7 +446,7 @@ int call_pregraph_sparse ( int argc, char ** argv )
 			pthread_mutex_init ( &file_lock, NULL );
 		}
 
-		build_preArc_threaded ( &arc_arr, &v_ht, K_size, cut_off_len, &in_filenames_vt, thrd_num );
+		build_preArc_threaded ( &arc_arr, &v_ht, K_size, cut_off_len, &in_filenames_vt, thrd_num_s );
 
 		if ( solve )
 		{
@@ -462,7 +463,7 @@ int call_pregraph_sparse ( int argc, char ** argv )
 			fclose ( mark_fp );
 
 			//output path_buffer
-			for ( int i = 0; i < thrd_num; i++ )
+			for ( int i = 0; i < thrd_num_s; i++ )
 			{
 				output_edge_path_buffer ( path_buffer[i], path_fp );
 			}
@@ -470,7 +471,7 @@ int call_pregraph_sparse ( int argc, char ** argv )
 			fclose ( path_fp );
 
 			//destory buffers ...
-			for ( int i = 0; i < thrd_num; i++ )
+			for ( int i = 0; i < thrd_num_s; i++ )
 			{
 				destory_edge_path_buffer ( path_buffer[i] );
 			}
@@ -540,7 +541,7 @@ static void initenv ( int argc, char ** argv )
 				continue;
 			case 'p':
 				sscanf ( optarg, "%s", temp );
-				thrd_num = atoi ( temp );
+				thrd_num_s = atoi ( temp );
 				continue;
 			case 'm':
 				continue;
@@ -616,7 +617,7 @@ static void parse_args ( vector<string> &in_filenames_vt )
 	}
 
 	fprintf ( stderr, " -r %d", run_mode );
-	fprintf ( stderr, " -p %d", thrd_num );
+	fprintf ( stderr, " -p %d", thrd_num_s );
 	fprintf ( stderr, " -o %s\n\n", graphfile );
 
 	if ( run_mode == 0 ) //build all
@@ -670,7 +671,7 @@ static void parse_args ( vector<string> &in_filenames_vt )
 
 static void display_pregraph_usage()
 {
-	fprintf ( stderr, "Usage: pregraph_sparse -s configFile -K kmer -z genomeSize -o outputGraph [-g maxKmerEdgeLength -d kmerFreqCutoff -e kmerEdgeFreqCutoff -R -r runMode -p n_cpu]\n" );
+	fprintf ( stderr, "Usage: sparse_pregraph -s configFile -K kmer -z genomeSize -o outputGraph [-g maxKmerEdgeLength -d kmerFreqCutoff -e kmerEdgeFreqCutoff -R -r runMode -p n_cpu]\n" );
 	fprintf ( stderr, "  -s <string>     configFile: the config file of solexa reads\n" );
 #ifdef _63MER_
 	fprintf ( stderr, "  -K <int>        kmer(min 13, max 63): kmer size, [23]\n" );
diff --git a/standardPregraph/INSTALL b/standardPregraph/INSTALL
deleted file mode 100644
index 7d38ca4..0000000
--- a/standardPregraph/INSTALL
+++ /dev/null
@@ -1,35 +0,0 @@
-
-Installation of SOAPdenovo-V2.04
-
-Ruibang Luo, 2012-7-10
-Zhenyu Li, 2012-7-10
-
-********************************************************************
-
-Pre-configurated Makefile was designed to handle most circumstances.
-
-************
-MAKE
-************
-
-Type "sh make.sh"  at root of unpacked folder to get both 63mer and 
-127mer versions.
-
-Type "make" or "make 63mer=1" at root of unpacked folder to get 63mer
- version only.
-
-Type "make 127mer=1" at root of unpacked folder to get 127mer version
- only.
-
-************
-CLEAN
-************
-
-Type "sh makeclean.sh" at root of unpacked folder to clean both 63mer
- and 127mer version.
-
-Type "make clean" or "make 63mer=1 clean" at root of unpacked folder 
-to clean 63mer version only.
-
-Type "make 127mer=1 clean" at root of unpacked folder to clean 127mer
- version only.
diff --git a/standardPregraph/Makefile b/standardPregraph/Makefile
index a8affc8..9716391 100644
--- a/standardPregraph/Makefile
+++ b/standardPregraph/Makefile
@@ -6,9 +6,13 @@
 ###################################
 
 CC=             gcc
-#GCCVERSIONMAJOR := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 4)
-#GCCVERSIONMINOR := $(shell expr `$(CC) -dumpversion | cut -f2 -d.` \>= 4)
+GCCVERSIONMAJOR := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 4)
+GCCVERSIONMINOR := $(shell expr `$(CC) -dumpversion | cut -f2 -d.` \>= 4)
+ifdef debug
+CFLAGS=         -O0 -g -fomit-frame-pointer #-static #-mcrc32 -march=core2 -msse4.1 -msse4.2
+else
 CFLAGS=         -O4 -fomit-frame-pointer #-static #-mcrc32 -march=core2 -msse4.1 -msse4.2
+endif
 DFLAGS=         
 OBJS=		arc.o attachPEinfo.o bubble.o check.o compactEdge.o \
 		concatenateEdge.o connect.o contig.o cutTipPreGraph.o cutTip_graph.o \
@@ -72,14 +76,16 @@ endif
 		@printf "Compiling $<...                             \r"; \
 		$(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $< || echo "Error in command: $(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $<"
 
-all:		clean SOAPdenovo
+all:		clean $(OBJS)
+
+#SOAPdenovo
 
 .PHONY:all clean install
 
 envTest:
 		@test $(BIT_ERR) != 1 || sh -c 'echo "Fatal: 64bit CPU and Operating System required!";false;'
-#		@test $(GCCVERSIONMAJOR) == 1 || sh -c 'echo "GCC version lower than 4.4.0";false;'
-#		@test $(GCCVERSIONMINOR) == 1 || sh -c 'echo "GCC version lower than 4.4.0";false;'
+		@test $(GCCVERSIONMAJOR) == 1 || sh -c 'echo "GCC version lower than 4.4.0";false;'
+		@test $(GCCVERSIONMINOR) == 1 || sh -c 'echo "GCC version lower than 4.4.0";false;'
 
 SOAPdenovo:	envTest $(OBJS)
 		@printf "Linking...                                                \r"
@@ -91,5 +97,5 @@ clean:
 		@printf "$(PROG) cleaning done.\n";
 
 install:
-		@mkdir -p ../bin; cp $(PROG) ../bin/
+		@cp $(PROG) ../bin/
 		@printf "$(PROG) installed at ../bin/$(PROG)\n"
diff --git a/standardPregraph/VERSION b/standardPregraph/VERSION
deleted file mode 100644
index 60ac010..0000000
--- a/standardPregraph/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-2.04
diff --git a/standardPregraph/inc/bam.h b/standardPregraph/inc/bam.h
deleted file mode 100644
index cb73716..0000000
--- a/standardPregraph/inc/bam.h
+++ /dev/null
@@ -1,711 +0,0 @@
-/* The MIT License
-
-   Copyright (c) 2008 Genome Research Ltd (GRL).
-
-   Permission is hereby granted, free of charge, to any person obtaining
-   a copy of this software and associated documentation files (the
-   "Software"), to deal in the Software without restriction, including
-   without limitation the rights to use, copy, modify, merge, publish,
-   distribute, sublicense, and/or sell copies of the Software, and to
-   permit persons to whom the Software is furnished to do so, subject to
-   the following conditions:
-
-   The above copyright notice and this permission notice shall be
-   included in all copies or substantial portions of the Software.
-
-   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-   SOFTWARE.
-*/
-
-/* Contact: Heng Li <lh3 at sanger.ac.uk> */
-
-#ifndef BAM_BAM_H
-#define BAM_BAM_H
-
-/*!
-  @header
-
-  BAM library provides I/O and various operations on manipulating files
-  in the BAM (Binary Alignment/Mapping) or SAM (Sequence Alignment/Map)
-  format. It now supports importing from or exporting to TAM, sorting,
-  merging, generating pileup, and quickly retrieval of reads overlapped
-  with a specified region.
-
-  @copyright Genome Research Ltd.
- */
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifndef BAM_LITE
-#define BAM_VIRTUAL_OFFSET16
-#include "bgzf.h"
-/*! @abstract BAM file handler */
-typedef BGZF * bamFile;
-#define bam_open(fn, mode) bgzf_open(fn, mode)
-#define bam_dopen(fd, mode) bgzf_fdopen(fd, mode)
-#define bam_close(fp) bgzf_close(fp)
-#define bam_read(fp, buf, size) bgzf_read(fp, buf, size)
-#define bam_write(fp, buf, size) bgzf_write(fp, buf, size)
-#define bam_tell(fp) bgzf_tell(fp)
-#define bam_seek(fp, pos, dir) bgzf_seek(fp, pos, dir)
-#else
-#define BAM_TRUE_OFFSET
-#include <zlib.h>
-typedef gzFile bamFile;
-#define bam_open(fn, mode) gzopen(fn, mode)
-#define bam_dopen(fd, mode) gzdopen(fd, mode)
-#define bam_close(fp) gzclose(fp)
-#define bam_read(fp, buf, size) gzread(fp, buf, size)
-/* no bam_write/bam_tell/bam_seek() here */
-#endif
-
-/*! @typedef
-  @abstract Structure for the alignment header.
-  @field n_targets   number of reference sequences
-  @field target_name names of the reference sequences
-  @field target_len  lengths of the referene sequences
-  @field dict        header dictionary
-  @field hash        hash table for fast name lookup
-  @field rg2lib      hash table for @RG-ID -> LB lookup
-  @field l_text      length of the plain text in the header
-  @field text        plain text
-
-  @discussion Field hash points to null by default. It is a private
-  member.
- */
-typedef struct
-{
-	int32_t n_targets;
-	char ** target_name;
-	uint32_t * target_len;
-	void * dict, *hash, *rg2lib;
-	int l_text;
-	char * text;
-} bam_header_t;
-
-/*! @abstract the read is paired in sequencing, no matter whether it is mapped in a pair */
-#define BAM_FPAIRED        1
-/*! @abstract the read is mapped in a proper pair */
-#define BAM_FPROPER_PAIR   2
-/*! @abstract the read itself is unmapped; conflictive with BAM_FPROPER_PAIR */
-#define BAM_FUNMAP         4
-/*! @abstract the mate is unmapped */
-#define BAM_FMUNMAP        8
-/*! @abstract the read is mapped to the reverse strand */
-#define BAM_FREVERSE      16
-/*! @abstract the mate is mapped to the reverse strand */
-#define BAM_FMREVERSE     32
-/*! @abstract this is read1 */
-#define BAM_FREAD1        64
-/*! @abstract this is read2 */
-#define BAM_FREAD2       128
-/*! @abstract not primary alignment */
-#define BAM_FSECONDARY   256
-/*! @abstract QC failure */
-#define BAM_FQCFAIL      512
-/*! @abstract optical or PCR duplicate */
-#define BAM_FDUP        1024
-
-#define BAM_OFDEC          0
-#define BAM_OFHEX          1
-#define BAM_OFSTR          2
-
-/*! @abstract defautl mask for pileup */
-#define BAM_DEF_MASK (BAM_FUNMAP | BAM_FSECONDARY | BAM_FQCFAIL | BAM_FDUP)
-
-#define BAM_CORE_SIZE   sizeof(bam1_core_t)
-
-/**
- * Describing how CIGAR operation/length is packed in a 32-bit integer.
- */
-#define BAM_CIGAR_SHIFT 4
-#define BAM_CIGAR_MASK  ((1 << BAM_CIGAR_SHIFT) - 1)
-
-/*
-  CIGAR operations.
- */
-/*! @abstract CIGAR: match */
-#define BAM_CMATCH      0
-/*! @abstract CIGAR: insertion to the reference */
-#define BAM_CINS        1
-/*! @abstract CIGAR: deletion from the reference */
-#define BAM_CDEL        2
-/*! @abstract CIGAR: skip on the reference (e.g. spliced alignment) */
-#define BAM_CREF_SKIP   3
-/*! @abstract CIGAR: clip on the read with clipped sequence present in qseq */
-#define BAM_CSOFT_CLIP  4
-/*! @abstract CIGAR: clip on the read with clipped sequence trimmed off */
-#define BAM_CHARD_CLIP  5
-/*! @abstract CIGAR: padding */
-#define BAM_CPAD        6
-
-/*! @typedef
-  @abstract Structure for core alignment information.
-  @field  tid     chromosome ID, defined by bam_header_t
-  @field  pos     0-based leftmost coordinate
-  @field  strand  strand; 0 for forward and 1 otherwise
-  @field  bin     bin calculated by bam_reg2bin()
-  @field  qual    mapping quality
-  @field  l_qname length of the query name
-  @field  flag    bitwise flag
-  @field  n_cigar number of CIGAR operations
-  @field  l_qseq  length of the query sequence (read)
- */
-typedef struct
-{
-	int32_t tid;
-	int32_t pos;
-	uint32_t bin: 16, qual: 8, l_qname: 8;
-	uint32_t flag: 16, n_cigar: 16;
-	int32_t l_qseq;
-	int32_t mtid;
-	int32_t mpos;
-	int32_t isize;
-} bam1_core_t;
-
-/*! @typedef
-  @abstract Structure for one alignment.
-  @field  core       core information about the alignment
-  @field  l_aux      length of auxiliary data
-  @field  data_len   current length of bam1_t::data
-  @field  m_data     maximum length of bam1_t::data
-  @field  data       all variable-length data, concatenated; structure: cigar-qname-seq-qual-aux
-
-  @discussion Notes:
-
-   1. qname is zero tailing and core.l_qname includes the tailing '\0'.
-   2. l_qseq is calculated from the total length of an alignment block
-      on reading or from CIGAR.
- */
-typedef struct
-{
-	bam1_core_t core;
-	int l_aux, data_len, m_data;
-	uint8_t * data;
-} bam1_t;
-
-#define bam1_strand(b) (((b)->core.flag&BAM_FREVERSE) != 0)
-#define bam1_mstrand(b) (((b)->core.flag&BAM_FMREVERSE) != 0)
-
-/*! @function
-  @abstract  Get the CIGAR array
-  @param  b  pointer to an alignment
-  @return    pointer to the CIGAR array
-
-  @discussion In the CIGAR array, each element is a 32-bit integer. The
-  lower 4 bits gives a CIGAR operation and the higher 28 bits keep the
-  length of a CIGAR.
- */
-#define bam1_cigar(b) ((uint32_t*)((b)->data + (b)->core.l_qname))
-
-/*! @function
-  @abstract  Get the name of the query
-  @param  b  pointer to an alignment
-  @return    pointer to the name string, null terminated
- */
-#define bam1_qname(b) ((char*)((b)->data))
-
-/*! @function
-  @abstract  Get query sequence
-  @param  b  pointer to an alignment
-  @return    pointer to sequence
-
-  @discussion Each base is encoded in 4 bits: 1 for A, 2 for C, 4 for G,
-  8 for T and 15 for N. Two bases are packed in one byte with the base
-  at the higher 4 bits having smaller coordinate on the read. It is
-  recommended to use bam1_seqi() macro to get the base.
- */
-#define bam1_seq(b) ((b)->data + (b)->core.n_cigar*4 + (b)->core.l_qname)
-
-/*! @function
-  @abstract  Get query quality
-  @param  b  pointer to an alignment
-  @return    pointer to quality string
- */
-#define bam1_qual(b) ((b)->data + (b)->core.n_cigar*4 + (b)->core.l_qname + ((b)->core.l_qseq + 1)/2)
-
-/*! @function
-  @abstract  Get a base on read
-  @param  s  Query sequence returned by bam1_seq()
-  @param  i  The i-th position, 0-based
-  @return    4-bit integer representing the base.
- */
-#define bam1_seqi(s, i) ((s)[(i)/2] >> 4*(1-(i)%2) & 0xf)
-
-/*! @function
-  @abstract  Get query sequence and quality
-  @param  b  pointer to an alignment
-  @return    pointer to the concatenated auxiliary data
- */
-#define bam1_aux(b) ((b)->data + (b)->core.n_cigar*4 + (b)->core.l_qname + (b)->core.l_qseq + ((b)->core.l_qseq + 1)/2)
-
-#ifndef kroundup32
-/*! @function
-  @abstract  Round an integer to the next closest power-2 integer.
-  @param  x  integer to be rounded (in place)
-  @discussion x will be modified.
- */
-#define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x))
-#endif
-
-/*!
-  @abstract Whether the machine is big-endian; modified only in
-  bam_header_init().
- */
-extern int bam_is_be;
-
-/*! @abstract Table for converting a nucleotide character to the 4-bit encoding. */
-extern unsigned char bam_nt16_table[256];
-
-/*! @abstract Table for converting a 4-bit encoded nucleotide to a letter. */
-extern char * bam_nt16_rev_table;
-
-extern char bam_nt16_nt4_table[];
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-	/*! @abstract TAM file handler */
-	typedef struct __tamFile_t * tamFile;
-
-	/*!
-	  @abstract   Open a SAM file for reading, either uncompressed or compressed by gzip/zlib.
-	  @param  fn  SAM file name
-	  @return     SAM file handler
-	 */
-	tamFile sam_open ( const char * fn );
-
-	/*!
-	  @abstract   Close a SAM file handler
-	  @param  fp  SAM file handler
-	 */
-	void sam_close ( tamFile fp );
-
-	/*!
-	  @abstract      Read one alignment from a SAM file handler
-	  @param  fp     SAM file handler
-	  @param  header header information (ordered names of chromosomes)
-	  @param  b      read alignment; all members in b will be updated
-	  @return        0 if successful; otherwise negative
-	 */
-	int sam_read1 ( tamFile fp, bam_header_t * header, bam1_t * b );
-
-	/*!
-	  @abstract       Read header information from a TAB-delimited list file.
-	  @param  fn_list file name for the list
-	  @return         a pointer to the header structure
-
-	  @discussion Each line in this file consists of chromosome name and
-	  the length of chromosome.
-	 */
-	bam_header_t * sam_header_read2 ( const char * fn_list );
-
-	/*!
-	  @abstract       Read header from a SAM file (if present)
-	  @param  fp      SAM file handler
-	  @return         pointer to header struct; 0 if no @SQ lines available
-	 */
-	bam_header_t * sam_header_read ( tamFile fp );
-
-	/*!
-	  @abstract       Parse @SQ lines a update a header struct
-	  @param  h       pointer to the header struct to be updated
-	  @return         number of target sequences
-
-	  @discussion bam_header_t::{n_targets,target_len,target_name} will
-	  be destroyed in the first place.
-	 */
-	int sam_header_parse ( bam_header_t * h );
-
-	/*!
-	  @abstract       Parse @RG lines a update a header struct
-	  @param  h       pointer to the header struct to be updated
-	  @return         number of @RG lines
-
-	  @discussion bam_header_t::rg2lib will be destroyed in the first
-	  place.
-	 */
-	int sam_header_parse_rg ( bam_header_t * h );
-
-#define sam_write1(header, b) bam_view1(header, b)
-
-	int bam_strmap_put ( void * strmap, const char * rg, const char * lib );
-	const char * bam_strmap_get ( const void * strmap, const char * rg );
-	void * bam_strmap_dup ( const void * );
-	void * bam_strmap_init();
-	void bam_strmap_destroy ( void * strmap );
-
-	/*!
-	  @abstract Initialize a header structure.
-	  @return   the pointer to the header structure
-
-	  @discussion This function also modifies the global variable
-	  bam_is_be.
-	 */
-	bam_header_t * bam_header_init();
-
-	/*!
-	  @abstract        Destroy a header structure.
-	  @param  header  pointer to the header
-	 */
-	void bam_header_destroy ( bam_header_t * header );
-
-	/*!
-	  @abstract   Read a header structure from BAM.
-	  @param  fp  BAM file handler, opened by bam_open()
-	  @return     pointer to the header structure
-
-	  @discussion The file position indicator must be placed at the
-	  beginning of the file. Upon success, the position indicator will
-	  be set at the start of the first alignment.
-	 */
-	bam_header_t * bam_header_read ( bamFile fp );
-
-	/*!
-	  @abstract      Write a header structure to BAM.
-	  @param  fp     BAM file handler
-	  @param  header pointer to the header structure
-	  @return        always 0 currently
-	 */
-	int bam_header_write ( bamFile fp, const bam_header_t * header );
-
-	/*!
-	  @abstract   Read an alignment from BAM.
-	  @param  fp  BAM file handler
-	  @param  b   read alignment; all members are updated.
-	  @return     number of bytes read from the file
-
-	  @discussion The file position indicator must be
-	  placed right before an alignment. Upon success, this function
-	  will set the position indicator to the start of the next
-	  alignment. This function is not affected by the machine
-	  endianness.
-	 */
-	int bam_read1 ( bamFile fp, bam1_t * b );
-
-	/*!
-	  @abstract Write an alignment to BAM.
-	  @param  fp       BAM file handler
-	  @param  c        pointer to the bam1_core_t structure
-	  @param  data_len total length of variable size data related to
-	                   the alignment
-	  @param  data     pointer to the concatenated data
-	  @return          number of bytes written to the file
-
-	  @discussion This function is not affected by the machine
-	  endianness.
-	 */
-	int bam_write1_core ( bamFile fp, const bam1_core_t * c, int data_len, uint8_t * data );
-
-	/*!
-	  @abstract   Write an alignment to BAM.
-	  @param  fp  BAM file handler
-	  @param  b   alignment to write
-	  @return     number of bytes written to the file
-
-	  @abstract It is equivalent to:
-	    bam_write1_core(fp, &b->core, b->data_len, b->data)
-	 */
-	int bam_write1 ( bamFile fp, const bam1_t * b );
-
-	/*! @function
-	  @abstract  Initiate a pointer to bam1_t struct
-	 */
-#define bam_init1() ((bam1_t*)calloc(1, sizeof(bam1_t)))
-
-	/*! @function
-	  @abstract  Free the memory allocated for an alignment.
-	  @param  b  pointer to an alignment
-	 */
-#define bam_destroy1(b) do {                    \
-		if (b) { free((b)->data); free(b); }    \
-	} while (0)
-
-	/*!
-	  @abstract       Format a BAM record in the SAM format
-	  @param  header  pointer to the header structure
-	  @param  b       alignment to print
-	  @return         a pointer to the SAM string
-	 */
-	char * bam_format1 ( const bam_header_t * header, const bam1_t * b );
-
-	char * bam_format1_core ( const bam_header_t * header, const bam1_t * b, int of );
-
-	const char * bam_get_library ( bam_header_t * header, const bam1_t * b );
-
-	/*! @typedef
-	  @abstract Structure for one alignment covering the pileup position.
-	  @field  b      pointer to the alignment
-	  @field  qpos   position of the read base at the pileup site, 0-based
-	  @field  indel  indel length; 0 for no indel, positive for ins and negative for del
-	  @field  is_del 1 iff the base on the padded read is a deletion
-	  @field  level  the level of the read in the "viewer" mode
-
-	  @discussion See also bam_plbuf_push() and bam_lplbuf_push(). The
-	  difference between the two functions is that the former does not
-	  set bam_pileup1_t::level, while the later does. Level helps the
-	  implementation of alignment viewers, but calculating this has some
-	  overhead.
-	 */
-	typedef struct
-	{
-		bam1_t * b;
-		int32_t qpos;
-		int indel, level;
-		uint32_t is_del: 1, is_head: 1, is_tail: 1;
-	} bam_pileup1_t;
-
-	struct __bam_plbuf_t;
-	/*! @abstract pileup buffer */
-	typedef struct __bam_plbuf_t bam_plbuf_t;
-
-	void bam_plbuf_set_mask ( bam_plbuf_t * buf, int mask );
-
-	/*! @typedef
-	  @abstract    Type of function to be called by bam_plbuf_push().
-	  @param  tid  chromosome ID as is defined in the header
-	  @param  pos  start coordinate of the alignment, 0-based
-	  @param  n    number of elements in pl array
-	  @param  pl   array of alignments
-	  @param  data user provided data
-	  @discussion  See also bam_plbuf_push(), bam_plbuf_init() and bam_pileup1_t.
-	 */
-	typedef int ( *bam_pileup_f ) ( uint32_t tid, uint32_t pos, int n, const bam_pileup1_t * pl, void * data );
-
-	/*!
-	  @abstract     Reset a pileup buffer for another pileup process
-	  @param  buf   the pileup buffer to be reset
-	 */
-	void bam_plbuf_reset ( bam_plbuf_t * buf );
-
-	/*!
-	  @abstract     Initialize a buffer for pileup.
-	  @param  func  fucntion to be called by bam_pileup_core()
-	  @param  data  user provided data
-	  @return       pointer to the pileup buffer
-	 */
-	bam_plbuf_t * bam_plbuf_init ( bam_pileup_f func, void * data );
-
-	/*!
-	  @abstract    Destroy a pileup buffer.
-	  @param  buf  pointer to the pileup buffer
-	 */
-	void bam_plbuf_destroy ( bam_plbuf_t * buf );
-
-	/*!
-	  @abstract    Push an alignment to the pileup buffer.
-	  @param  b    alignment to be pushed
-	  @param  buf  pileup buffer
-	  @see         bam_plbuf_init()
-	  @return      always 0 currently
-
-	  @discussion If all the alignments covering a particular site have
-	  been collected, this function will call the user defined function
-	  as is provided to bam_plbuf_init(). The coordinate of the site and
-	  all the alignments will be transferred to the user defined
-	  function as function parameters.
-
-	  When all the alignments are pushed to the buffer, this function
-	  needs to be called with b equal to NULL. This will flush the
-	  buffer. A pileup buffer can only be reused when bam_plbuf_reset()
-	  is called.
-	 */
-	int bam_plbuf_push ( const bam1_t * b, bam_plbuf_t * buf );
-
-	int bam_pileup_file ( bamFile fp, int mask, bam_pileup_f func, void * func_data );
-
-	struct __bam_lplbuf_t;
-	typedef struct __bam_lplbuf_t bam_lplbuf_t;
-
-	void bam_lplbuf_reset ( bam_lplbuf_t * buf );
-
-	/*! @abstract  bam_plbuf_init() equivalent with level calculated. */
-	bam_lplbuf_t * bam_lplbuf_init ( bam_pileup_f func, void * data );
-
-	/*! @abstract  bam_plbuf_destroy() equivalent with level calculated. */
-	void bam_lplbuf_destroy ( bam_lplbuf_t * tv );
-
-	/*! @abstract  bam_plbuf_push() equivalent with level calculated. */
-	int bam_lplbuf_push ( const bam1_t * b, bam_lplbuf_t * buf );
-
-	struct __bam_index_t;
-	typedef struct __bam_index_t bam_index_t;
-
-	/*!
-	  @abstract   Build index for a BAM file.
-	  @discussion Index file "fn.bai" will be created.
-	  @param  fn  name of the BAM file
-	  @return     always 0 currently
-	 */
-	int bam_index_build ( const char * fn );
-
-	/*!
-	  @abstract   Load index from file "fn.bai".
-	  @param  fn  name of the BAM file (NOT the index file)
-	  @return     pointer to the index structure
-	 */
-	bam_index_t * bam_index_load ( const char * fn );
-
-	/*!
-	  @abstract    Destroy an index structure.
-	  @param  idx  pointer to the index structure
-	 */
-	void bam_index_destroy ( bam_index_t * idx );
-
-	/*! @typedef
-	  @abstract      Type of function to be called by bam_fetch().
-	  @param  b     the alignment
-	  @param  data  user provided data
-	 */
-	typedef int ( *bam_fetch_f ) ( const bam1_t * b, void * data );
-
-	/*!
-	  @abstract Retrieve the alignments that are overlapped with the
-	  specified region.
-
-	  @discussion A user defined function will be called for each
-	  retrieved alignment ordered by its start position.
-
-	  @param  fp    BAM file handler
-	  @param  idx   pointer to the alignment index
-	  @param  tid   chromosome ID as is defined in the header
-	  @param  beg   start coordinate, 0-based
-	  @param  end   end coordinate, 0-based
-	  @param  data  user provided data (will be transferred to func)
-	  @param  func  user defined function
-	 */
-	int bam_fetch ( bamFile fp, const bam_index_t * idx, int tid, int beg, int end, void * data, bam_fetch_f func );
-
-	/*!
-	  @abstract       Parse a region in the format: "chr2:100,000-200,000".
-	  @discussion     bam_header_t::hash will be initialized if empty.
-	  @param  header  pointer to the header structure
-	  @param  str     string to be parsed
-	  @param  ref_id  the returned chromosome ID
-	  @param  begin   the returned start coordinate
-	  @param  end     the returned end coordinate
-	  @return         0 on success; -1 on failure
-	 */
-	int bam_parse_region ( bam_header_t * header, const char * str, int * ref_id, int * begin, int * end );
-
-	/*!
-	  @abstract       Retrieve data of a tag
-	  @param  b       pointer to an alignment struct
-	  @param  tag     two-character tag to be retrieved
-
-	  @return  pointer to the type and data. The first character is the
-	  type that can be 'iIsScCdfAZH'.
-
-	  @discussion  Use bam_aux2?() series to convert the returned data to
-	  the corresponding type.
-	*/
-	uint8_t * bam_aux_get ( const bam1_t * b, const char tag[2] );
-
-	int32_t bam_aux2i ( const uint8_t * s );
-	float bam_aux2f ( const uint8_t * s );
-	double bam_aux2d ( const uint8_t * s );
-	char bam_aux2A ( const uint8_t * s );
-	char * bam_aux2Z ( const uint8_t * s );
-
-	int bam_aux_del ( bam1_t * b, uint8_t * s );
-	void bam_aux_append ( bam1_t * b, const char tag[2], char type, int len, uint8_t * data );
-	uint8_t * bam_aux_get_core ( bam1_t * b, const char tag[2] ); // an alias of bam_aux_get()
-
-	/*!
-	  @abstract Calculate the rightmost coordinate of an alignment on the
-	  reference genome.
-
-	  @param  c      pointer to the bam1_core_t structure
-	  @param  cigar  the corresponding CIGAR array (from bam1_t::cigar)
-	  @return        the rightmost coordinate, 0-based
-	*/
-	uint32_t bam_calend ( const bam1_core_t * c, const uint32_t * cigar );
-
-	/*!
-	  @abstract      Calculate the length of the query sequence from CIGAR.
-	  @param  c      pointer to the bam1_core_t structure
-	  @param  cigar  the corresponding CIGAR array (from bam1_t::cigar)
-	  @return        length of the query sequence
-	*/
-	int32_t bam_cigar2qlen ( const bam1_core_t * c, const uint32_t * cigar );
-
-#ifdef __cplusplus
-}
-#endif
-
-/*!
-  @abstract    Calculate the minimum bin that contains a region [beg,end).
-  @param  beg  start of the region, 0-based
-  @param  end  end of the region, 0-based
-  @return      bin
- */
-static inline int bam_reg2bin ( uint32_t beg, uint32_t end )
-{
-	--end;
-
-	if ( beg >> 14 == end >> 14 ) { return 4681 + ( beg >> 14 ); }
-
-	if ( beg >> 17 == end >> 17 ) { return  585 + ( beg >> 17 ); }
-
-	if ( beg >> 20 == end >> 20 ) { return   73 + ( beg >> 20 ); }
-
-	if ( beg >> 23 == end >> 23 ) { return    9 + ( beg >> 23 ); }
-
-	if ( beg >> 26 == end >> 26 ) { return    1 + ( beg >> 26 ); }
-
-	return 0;
-}
-
-/*!
-  @abstract     Copy an alignment
-  @param  bdst  destination alignment struct
-  @param  bsrc  source alignment struct
-  @return       pointer to the destination alignment struct
- */
-static inline bam1_t * bam_copy1 ( bam1_t * bdst, const bam1_t * bsrc )
-{
-	uint8_t * data = bdst->data;
-	int m_data = bdst->m_data;   // backup data and m_data
-
-	if ( m_data < bsrc->m_data ) // double the capacity
-	{
-		m_data = bsrc->m_data;
-		kroundup32 ( m_data );
-		data = ( uint8_t * ) realloc ( data, m_data );
-	}
-
-	memcpy ( data, bsrc->data, bsrc->data_len ); // copy var-len data
-	*bdst = *bsrc; // copy the rest
-	// restore the backup
-	bdst->m_data = m_data;
-	bdst->data = data;
-	return bdst;
-}
-
-/*!
-  @abstract     Duplicate an alignment
-  @param  src   source alignment struct
-  @return       pointer to the destination alignment struct
- */
-static inline bam1_t * bam_dup1 ( const bam1_t * src )
-{
-	bam1_t * b;
-	b = bam_init1();
-	*b = *src;
-	b->m_data = b->data_len;
-	b->data = ( uint8_t * ) calloc ( b->data_len, 1 );
-	memcpy ( b->data, src->data, b->data_len );
-	return b;
-}
-
-#endif
diff --git a/standardPregraph/inc/bgzf.h b/standardPregraph/inc/bgzf.h
deleted file mode 100644
index 7b93d76..0000000
--- a/standardPregraph/inc/bgzf.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* The MIT License
-
-   Copyright (c) 2008 Broad Institute / Massachusetts Institute of Technology
-
-   Permission is hereby granted, free of charge, to any person obtaining a copy
-   of this software and associated documentation files (the "Software"), to deal
-   in the Software without restriction, including without limitation the rights
-   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-   copies of the Software, and to permit persons to whom the Software is
-   furnished to do so, subject to the following conditions:
-
-   The above copyright notice and this permission notice shall be included in
-   all copies or substantial portions of the Software.
-
-   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-   THE SOFTWARE.
-*/
-
-#ifndef __BGZF_H
-#define __BGZF_H
-
-#include <stdint.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <zlib.h>
-#ifdef _USE_KNETFILE
-#include "knetfile.h"
-#endif
-
-//typedef int8_t bool;
-
-typedef struct
-{
-	int file_descriptor;
-	char open_mode;  // 'r' or 'w'
-	bool owned_file, is_uncompressed;
-#ifdef _USE_KNETFILE
-	union
-	{
-		knetFile * fpr;
-		FILE * fpw;
-	} x;
-#else
-	FILE * file;
-#endif
-	int uncompressed_block_size;
-	int compressed_block_size;
-	void * uncompressed_block;
-	void * compressed_block;
-	int64_t block_address;
-	int block_length;
-	int block_offset;
-	int cache_size;
-	const char * error;
-	void * cache; // a pointer to a hash table
-} BGZF;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-	/*
-	 * Open an existing file descriptor for reading or writing.
-	 * Mode must be either "r" or "w".
-	 * A subsequent bgzf_close will not close the file descriptor.
-	 * Returns null on error.
-	 */
-	BGZF * bgzf_fdopen ( int fd, const char * __restrict mode );
-
-	/*
-	 * Open the specified file for reading or writing.
-	 * Mode must be either "r" or "w".
-	 * Returns null on error.
-	 */
-	BGZF * bgzf_open ( const char * path, const char * __restrict mode );
-
-	/*
-	 * Close the BGZ file and free all associated resources.
-	 * Does not close the underlying file descriptor if created with bgzf_fdopen.
-	 * Returns zero on success, -1 on error.
-	 */
-	int bgzf_close ( BGZF * fp );
-
-	/*
-	 * Read up to length bytes from the file storing into data.
-	 * Returns the number of bytes actually read.
-	 * Returns zero on end of file.
-	 * Returns -1 on error.
-	 */
-	int bgzf_read ( BGZF * fp, void * data, int length );
-
-	/*
-	 * Write length bytes from data to the file.
-	 * Returns the number of bytes written.
-	 * Returns -1 on error.
-	 */
-	int bgzf_write ( BGZF * fp, const void * data, int length );
-
-	/*
-	 * Return a virtual file pointer to the current location in the file.
-	 * No interpetation of the value should be made, other than a subsequent
-	 * call to bgzf_seek can be used to position the file at the same point.
-	 * Return value is non-negative on success.
-	 * Returns -1 on error.
-	 */
-	int64_t bgzf_tell ( BGZF * fp );
-
-	/*
-	 * Set the file to read from the location specified by pos, which must
-	 * be a value previously returned by bgzf_tell for this file (but not
-	 * necessarily one returned by this file handle).
-	 * The where argument must be SEEK_SET.
-	 * Seeking on a file opened for write is not supported.
-	 * Returns zero on success, -1 on error.
-	 */
-	int64_t bgzf_seek ( BGZF * fp, int64_t pos, int where );
-
-	/*
-	 * Set the cache size. Zero to disable. By default, caching is
-	 * disabled. The recommended cache size for frequent random access is
-	 * about 8M bytes.
-	 */
-	void bgzf_set_cache_size ( BGZF * fp, int cache_size );
-
-	int bgzf_check_EOF ( BGZF * fp );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/standardPregraph/inc/def.h b/standardPregraph/inc/def.h
index 18c8505..c4ba677 100644
--- a/standardPregraph/inc/def.h
+++ b/standardPregraph/inc/def.h
@@ -94,6 +94,14 @@ typedef struct edge
 	long long * markers;    //reads id
 } EDGE;
 
+typedef struct edge_sub
+{
+	unsigned int from_vt;   //from kmer id
+	unsigned int to_vt; //to kmer id
+	int length;         //edge length
+	char  *  seq;   //edge content
+} EDGE_SUB;
+
 typedef struct edge_pt
 {
 	EDGE * edge;
diff --git a/standardPregraph/inc/sam.h b/standardPregraph/inc/sam.h
deleted file mode 100644
index 26e7a1e..0000000
--- a/standardPregraph/inc/sam.h
+++ /dev/null
@@ -1,100 +0,0 @@
-#ifndef BAM_SAM_H
-#define BAM_SAM_H
-
-#include "bam.h"
-
-/*!
-  @header
-
-  This file provides higher level of I/O routines and unifies the APIs
-  for SAM and BAM formats. These APIs are more convenient and
-  recommended.
-
-  @copyright Genome Research Ltd.
- */
-
-/*! @typedef
-  @abstract SAM/BAM file handler
-  @field  type    type of the handler; bit 1 for BAM, 2 for reading and bit 3-4 for flag format
-  @field  bam   BAM file handler; valid if (type&1) == 1
-  @field  tamr  SAM file handler for reading; valid if type == 2
-  @field  tamw  SAM file handler for writing; valid if type == 0
-  @field  header  header struct
- */
-typedef struct
-{
-	int type;
-	union
-	{
-		tamFile tamr;
-		bamFile bam;
-		FILE * tamw;
-	} x;
-	bam_header_t * header;
-} samfile_t;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-	/*!
-	  @abstract     Open a SAM/BAM file
-
-	  @param fn SAM/BAM file name; "-" is recognized as stdin (for
-	  reading) or stdout (for writing).
-
-	  @param mode open mode /[rw](b?)(u?)(h?)([xX]?)/: 'r' for reading,
-	  'w' for writing, 'b' for BAM I/O, 'u' for uncompressed BAM output,
-	  'h' for outputing header in SAM, 'x' for HEX flag and 'X' for
-	  string flag. If 'b' present, it must immediately follow 'r' or
-	  'w'. Valid modes are "r", "w", "wh", "wx", "whx", "wX", "whX",
-	  "rb", "wb" and "wbu" exclusively.
-
-	  @param aux auxiliary data; if mode[0]=='w', aux points to
-	  bam_header_t; if strcmp(mode, "rb")!=0 and @SQ header lines in SAM
-	  are absent, aux points the file name of the list of the reference;
-	  aux is not used otherwise. If @SQ header lines are present in SAM,
-	  aux is not used, either.
-
-	  @return       SAM/BAM file handler
-	 */
-	samfile_t * samopen ( const char * fn, const char * mode, const void * aux );
-
-	/*!
-	  @abstract     Close a SAM/BAM handler
-	  @param  fp    file handler to be closed
-	 */
-	void samclose ( samfile_t * fp );
-
-	/*!
-	  @abstract     Read one alignment
-	  @param  fp    file handler
-	  @param  b     alignment
-	  @return       bytes read
-	 */
-	int samread ( samfile_t * fp, bam1_t * b );
-
-	/*!
-	  @abstract     Write one alignment
-	  @param  fp    file handler
-	  @param  b     alignment
-	  @return       bytes written
-	 */
-	int samwrite ( samfile_t * fp, const bam1_t * b );
-
-	/*!
-	  @abstract     Get the pileup for a whole alignment file
-	  @param  fp    file handler
-	  @param  mask  mask transferred to bam_plbuf_set_mask()
-	  @param  func  user defined function called in the pileup process
-	  #param  data  user provided data for func()
-	 */
-	int sampileup ( samfile_t * fp, int mask, bam_pileup_f func, void * data );
-
-	char * samfaipath ( const char * fn_ref );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/standardPregraph/inc/zconf.h b/standardPregraph/inc/zconf.h
deleted file mode 100644
index bdb26f5..0000000
--- a/standardPregraph/inc/zconf.h
+++ /dev/null
@@ -1,332 +0,0 @@
-/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#ifndef ZCONF_H
-#define ZCONF_H
-
-/*
- * If you *really* need a unique prefix for all types and library functions,
- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
- */
-#ifdef Z_PREFIX
-#  define deflateInit_          z_deflateInit_
-#  define deflate               z_deflate
-#  define deflateEnd            z_deflateEnd
-#  define inflateInit_          z_inflateInit_
-#  define inflate               z_inflate
-#  define inflateEnd            z_inflateEnd
-#  define deflateInit2_         z_deflateInit2_
-#  define deflateSetDictionary  z_deflateSetDictionary
-#  define deflateCopy           z_deflateCopy
-#  define deflateReset          z_deflateReset
-#  define deflateParams         z_deflateParams
-#  define deflateBound          z_deflateBound
-#  define deflatePrime          z_deflatePrime
-#  define inflateInit2_         z_inflateInit2_
-#  define inflateSetDictionary  z_inflateSetDictionary
-#  define inflateSync           z_inflateSync
-#  define inflateSyncPoint      z_inflateSyncPoint
-#  define inflateCopy           z_inflateCopy
-#  define inflateReset          z_inflateReset
-#  define inflateBack           z_inflateBack
-#  define inflateBackEnd        z_inflateBackEnd
-#  define compress              z_compress
-#  define compress2             z_compress2
-#  define compressBound         z_compressBound
-#  define uncompress            z_uncompress
-#  define adler32               z_adler32
-#  define crc32                 z_crc32
-#  define get_crc_table         z_get_crc_table
-#  define zError                z_zError
-
-#  define alloc_func            z_alloc_func
-#  define free_func             z_free_func
-#  define in_func               z_in_func
-#  define out_func              z_out_func
-#  define Byte                  z_Byte
-#  define uInt                  z_uInt
-#  define uLong                 z_uLong
-#  define Bytef                 z_Bytef
-#  define charf                 z_charf
-#  define intf                  z_intf
-#  define uIntf                 z_uIntf
-#  define uLongf                z_uLongf
-#  define voidpf                z_voidpf
-#  define voidp                 z_voidp
-#endif
-
-#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 0           /* HAVE_UNISTD_H -- this line is updated by ./configure */
-#  include <sys/types.h> /* for off_t */
-#  include <unistd.h>    /* for SEEK_* and off_t */
-#  ifdef VMS
-#    include <unixio.h>   /* for off_t */
-#  endif
-#  define z_off_t off_t
-#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(__OS400__)
-#  define NO_vsnprintf
-#endif
-
-#if defined(__MVS__)
-#  define NO_vsnprintf
-#  ifdef FAR
-#    undef FAR
-#  endif
-#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/standardPregraph/inc/zlib.h b/standardPregraph/inc/zlib.h
deleted file mode 100644
index 326df1a..0000000
--- a/standardPregraph/inc/zlib.h
+++ /dev/null
@@ -1,1359 +0,0 @@
-/* zlib.h -- interface of the 'zlib' general purpose compression library
-  version 1.2.3, July 18th, 2005
-
-  Copyright (C) 1995-2005 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.3"
-#define ZLIB_VERNUM 0x1230
-
-	/*
-	     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 (for example if an input file is mmap'ed), 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 /* will be removed, use Z_SYNC_FLUSH instead */
-#define Z_SYNC_FLUSH    2
-#define Z_FULL_FLUSH    3
-#define Z_FINISH        4
-#define Z_BLOCK         5
-	/* 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,
-	   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 accumualte 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.
-
-	    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 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.  msg is set to null if there is no error
-	   message. inflateInit does not perform any decompression apart from reading
-	   the zlib header if present: this will be done by inflate().  (So next_in and
-	   avail_in may be modified, but next_out and avail_out are unchanged.)
-	*/
-
-
-	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, or Z_BLOCK. 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.
-
-	    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 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() will decompress and check either zlib-wrapped or gzip-wrapped
-	  deflate data.  The header type is detected automatically.  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
-	  if next_in or next_out was 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 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 a parameter is invalid (such as an invalid
-	   method). 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 in
-	   deflate or deflate2. 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 (such as NULL dictionary) 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 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 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().  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 -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_STREAM_ERROR if a parameter is invalid (such as a null strm). msg
-	   is set to null if there is no error message.  inflateInit2 does not perform
-	   any decompression apart from reading the zlib header if present: this will
-	   be done by inflate(). (So next_in and avail_in may be modified, but next_out
-	   and avail_out are unchanged.)
-	*/
-
-	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 (such as NULL dictionary) 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 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 NULL).
-	*/
-
-	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.
-
-	      inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the 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 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 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 easily 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.
-	     This function can be used to compress a whole file at once if the
-	   input file is mmap'ed.
-	     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 compressed buffer.
-	     This function can be used to decompress a whole file at once if the
-	   input file is mmap'ed.
-
-	     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.
-	*/
-
-
-	typedef voidp gzFile;
-
-	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", or 'R' for run-length encoding
-	   as in "wb1R". (See the description of deflateInit2 for more information
-	   about the strategy parameter.)
-
-	     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 or if there was
-	   insufficient memory to allocate the (de)compression state; errno
-	   can be checked to distinguish the two cases (if errno is zero, the
-	   zlib error is Z_MEM_ERROR).  */
-
-	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 (in 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 gzdopen(dup(fd), mode).
-	     gzdopen returns NULL if there was insufficient memory to allocate
-	   the (de)compression state.
-	*/
-
-	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.
-	     gzread returns the number of uncompressed bytes actually read (0 for
-	   end of file, -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 actually written
-	   (0 in case of error).
-	*/
-
-	ZEXTERN int ZEXPORTVA   gzprintf OF ( ( gzFile file, const char * format, ... ) );
-	/*
-	     Converts, formats, and writes the args to the compressed file under
-	   control of the format string, as in fprintf. gzprintf returns the number of
-	   uncompressed bytes actually written (0 in case of error).  The number of
-	   uncompressed bytes written is limited to 4095. The caller should assure that
-	   this limit is not exceeded. If it is exceeded, then gzprintf() will return
-	   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.
-	*/
-
-	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.  The string is then terminated with a null
-	   character.
-	      gzgets returns buf, or Z_NULL in case of error.
-	*/
-
-	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 again later.
-	   Only one character of push-back is allowed.  gzungetc() returns the
-	   character pushed, or -1 on failure.  gzungetc() will fail if a
-	   character has been pushed but not read yet, or if c is -1. 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 returns Z_OK if
-	   the flush parameter is Z_FINISH and all output could be flushed.
-	     gzflush should be called only when strictly necessary because it can
-	   degrade compression.
-	*/
-
-	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.
-
-	   gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
-	*/
-
-	ZEXTERN int ZEXPORT gzeof OF ( ( gzFile file ) );
-	/*
-	     Returns 1 when EOF has previously been detected reading the given
-	   input stream, otherwise zero.
-	*/
-
-	ZEXTERN int ZEXPORT gzdirect OF ( ( gzFile file ) );
-	/*
-	     Returns 1 if file is being read directly without decompression, otherwise
-	   zero.
-	*/
-
-	ZEXTERN int ZEXPORT    gzclose OF ( ( gzFile file ) );
-	/*
-	     Flushes all pending output if necessary, closes the compressed file
-	   and deallocates all the (de)compression state. The return value is the zlib
-	   error number (see function gzerror below).
-	*/
-
-	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.
-	*/
-
-	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 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 new_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 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))
-
-
-#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
-	struct internal_state {int dummy;}; /* hack for buggy compilers */
-#endif
-
-	ZEXTERN const char  *  ZEXPORT zError           OF ( ( int ) );
-	ZEXTERN int            ZEXPORT inflateSyncPoint OF ( ( z_streamp z ) );
-	ZEXTERN const uLongf * ZEXPORT get_crc_table    OF ( ( void ) );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ZLIB_H */
diff --git a/standardPregraph/iterate.c b/standardPregraph/iterate.c
index 11e27e4..610b253 100644
--- a/standardPregraph/iterate.c
+++ b/standardPregraph/iterate.c
@@ -30,7 +30,7 @@ static Kmer * kmerBuffer;
 static ubyte8 * hashBanBuffer;
 
 static char * flagBuffer;
-static int buffer_size = 10000000;
+static int buffer_size = 100000000;//2013-5-13
 long long foundcount = 0;
 long long notfoundcount = 0;
 long long newfoundcount = 0;
@@ -1762,9 +1762,9 @@ Return:
 *************************************************/
 static int cmp_seq ( const void * a, const void * b )
 {
-	EDGE * A, *B;
-	A = ( EDGE * ) a;
-	B = ( EDGE * ) b;
+	EDGE_SUB * A, *B;
+	A = ( EDGE_SUB * ) a;
+	B = ( EDGE_SUB * ) b;
 
 	if ( KmerLarger ( vt_array[A->from_vt].kmer, vt_array[B->from_vt].kmer ) )
 	{
@@ -1882,11 +1882,104 @@ Output:
 Return:
     None.
 *************************************************/
+///*
 void sortedge()
 {
 	unsigned int index ;
-	EDGE * sort_edge , * backup_edge ;
-	sort_edge = ( EDGE * ) ckalloc ( sizeof ( EDGE ) * ( num_ed + 1 ) );
+	EDGE_SUB * sort_edge;
+	sort_edge = ( EDGE_SUB * ) ckalloc ( sizeof ( EDGE_SUB ) * ( num_ed + 1 ) );
+	unsigned int i = 1;
+
+	for ( index = 1 ; index <= num_ed ; index ++ )
+	{
+		sort_edge[i].from_vt = edge_array[index].from_vt;
+		sort_edge[i].seq = edge_array[index].seq;
+		sort_edge[i].to_vt = index; // record old id
+		sort_edge[i].length = edge_array[index].length;
+		i++;
+
+		if ( !EdSameAsTwin ( index ) )
+		{
+			index++;
+		}
+	}
+
+	qsort ( & ( sort_edge[1] ), i - 1, sizeof ( sort_edge[1] ), cmp_seq );
+	index_array = ( unsigned int * ) ckalloc ( sizeof ( unsigned int ) * ( num_ed + 1 ) ); // used to record new id
+	unsigned int new_index = 1, old_index;
+
+	for ( index = 1; index <= i - 1; index++ )
+	{
+		old_index = sort_edge[index].to_vt; // old id
+		sort_edge[index].seq = NULL;
+		index_array[old_index] = new_index++;// old id -> new id
+
+		if ( !EdSameAsTwin ( old_index ) )
+		{
+			index_array[old_index + 1] = new_index++; // old id -> new id
+		}
+	}
+
+	bool * copy_array = (bool * ) ckalloc ( sizeof ( bool ) * ( num_ed + 1 ) );
+	EDGE *old_edge = ( EDGE * ) ckalloc ( sizeof ( EDGE ) );
+	EDGE *new_edge = ( EDGE * ) ckalloc ( sizeof ( EDGE ) );
+	unsigned int next_index;
+	for ( index = 1; index <= num_ed; index++ )
+	{
+		if(!copy_array[index])
+		{
+			next_index = index;
+			new_index = index_array[next_index];
+			if(!copy_array[next_index])// && next_index != new_index
+			{
+				if(copy_array[new_index])
+				{
+					fprintf(stderr, "Copy error: never reach here.");
+				}
+				copy_array[next_index] = 1;
+				if(next_index != new_index)
+				{
+					copyOneEdge (old_edge, &(edge_array[new_index]));
+					copyOneEdge ( & ( edge_array[new_index] ), & ( edge_array[next_index] ) );
+				}
+				updateArcToEd ( new_index );
+
+				next_index = new_index;
+				new_index = index_array[next_index];
+				while(!copy_array[next_index])
+				{
+					if(next_index == new_index)
+					{
+						fprintf(stderr, "Index error: never reach here.");
+					}
+					copy_array[next_index] = 1;
+					copyOneEdge (new_edge, &(edge_array[new_index]));
+					copyOneEdge ( & ( edge_array[new_index] ), old_edge);
+					updateArcToEd ( new_index );
+					copyOneEdge (old_edge, new_edge);
+
+					next_index = new_index;
+					new_index = index_array[next_index];
+				}
+			}
+		}
+	}
+
+	free (copy_array);
+	free (old_edge);
+	free (new_edge);
+	free ( index_array );
+	free ( sort_edge );
+	fprintf(stderr, "%d edge(s) sorted.\n", num_ed);
+}
+//*/
+/*
+void sortedge()
+{
+	unsigned int index ;
+	EDGE * backup_edge ;
+	EDGE_SUB * sort_edge;
+	sort_edge = ( EDGE_SUB * ) ckalloc ( sizeof ( EDGE_SUB ) * ( num_ed + 1 ) );
 	backup_edge = ( EDGE * ) ckalloc ( sizeof ( EDGE ) * ( num_ed + 1 ) );
 	unsigned int i = 1;
 
@@ -1932,8 +2025,9 @@ void sortedge()
 	free ( index_array );
 	free ( sort_edge );
 	free ( backup_edge );
+	fprintf(stderr, "%d edge(s) sorted.\n", num_ed);
 }
-
+*/
 /*************************************************
 Function:
     delete0Edge
@@ -2172,7 +2266,8 @@ ARC * sort_arc ( ARC * list )
 	if ( !list )
 		{ return list; }
 
-	ARC * head = ( ARC * ) malloc ( sizeof ( ARC ) );
+//	ARC * head = ( ARC * ) malloc ( sizeof ( ARC ) );
+	ARC * head = ( ARC * ) ckalloc ( sizeof ( ARC ));
 	head->next = list;
 	list->prev = head;
 	ARC * curr = list;
@@ -2239,6 +2334,7 @@ void freshArc()
 
 		edge_array[i].arcs = sort_arc ( edge_array[i].arcs );
 	}
+	fprintf(stderr, "Arcs sorted.\n");
 }
 
 /*************************************************
diff --git a/standardPregraph/main.c b/standardPregraph/main.c
index 0005837..98170e4 100644
--- a/standardPregraph/main.c
+++ b/standardPregraph/main.c
@@ -27,6 +27,7 @@
 #include "global.h"
 
 extern int call_pregraph ( int arc, char ** argv );
+extern int call_pregraph_sparse(int arc, char ** argv);
 extern int call_heavygraph ( int arc, char ** argv );
 extern int call_map2contig ( int arc, char ** argv );
 extern int call_scaffold ( int arc, char ** argv );
@@ -72,6 +73,10 @@ int main ( int argc, char ** argv )
 	{
 		call_pregraph ( argc, argv );
 	}
+	else if(strcmp ( "sparse_pregraph", argv[0] ) == 0 ){
+		call_pregraph_sparse ( argc, argv );
+
+	}
 	else if ( strcmp ( "contig", argv[0] ) == 0 )
 	{
 		call_heavygraph ( argc, argv );
@@ -100,11 +105,12 @@ int main ( int argc, char ** argv )
 static void display_usage ()
 {
 	fprintf ( stderr, "\nUsage: SOAPdenovo <command> [option]\n" );
-	fprintf ( stderr, "    pregraph     construct kmer-graph\n" );
-	fprintf ( stderr, "    contig       eliminate errors and output contigs\n" );
-	fprintf ( stderr, "    map          map reads to contigs\n" );
-	fprintf ( stderr, "    scaff        construct scaffolds\n" );
-	fprintf ( stderr, "    all          do all the above in turn\n" );
+	fprintf ( stderr, "    pregraph        construct kmer-graph\n" );
+	fprintf ( stderr, "    sparse_pregraph construct sparse kmer-graph\n");
+	fprintf ( stderr, "    contig          eliminate errors and output contigs\n" );
+	fprintf ( stderr, "    map             map reads to contigs\n" );
+	fprintf ( stderr, "    scaff           construct scaffolds\n" );
+	fprintf ( stderr, "    all             do pregraph-contig-map-scaff in turn\n" );
 }
 
 static void pipeline ( int argc, char ** argv )
diff --git a/standardPregraph/prlHashReads.c b/standardPregraph/prlHashReads.c
index 27cea1b..6a9158e 100644
--- a/standardPregraph/prlHashReads.c
+++ b/standardPregraph/prlHashReads.c
@@ -490,6 +490,7 @@ boolean prlRead2HashTable ( char * libfile, char * outfile )
 							if ( start1 >= offset1 )
 							{
 								start1 = 0;
+								offset1 = 0;
 								flag1 = AIORead ( &aio1, &offset1, readBuffer1, cach1, &rt1, lib_array[libNo].curr_type );
 							}
 
@@ -503,6 +504,7 @@ boolean prlRead2HashTable ( char * libfile, char * outfile )
 						if ( start1 >= offset1 )
 						{
 							start1 = 0;
+							offset1 = 0;
 							flag1 = AIORead ( &aio1, &offset1, readBuffer1, cach1, &rt1, lib_array[libNo].curr_type );
 						}
 
@@ -536,6 +538,7 @@ boolean prlRead2HashTable ( char * libfile, char * outfile )
 							if ( start2 >= offset2 )
 							{
 								start2 = 0;
+								offset2 = 0;
 								flag2 = AIORead ( &aio2, &offset2, readBuffer2, cach2, &rt2, lib_array[libNo].curr_type );
 							}
 
@@ -552,6 +555,7 @@ boolean prlRead2HashTable ( char * libfile, char * outfile )
 						if ( start2 >= offset2 )
 						{
 							start2 = 0;
+							offset2 = 0;
 							flag2 = AIORead ( &aio2, &offset2, readBuffer2, cach2, &rt2, lib_array[libNo].curr_type );
 						}
 
@@ -567,6 +571,10 @@ boolean prlRead2HashTable ( char * libfile, char * outfile )
 					}
 				}
 			}
+			else
+			{
+				fprintf(stderr, "Error: aio_read error.\n");
+			}
 		}
 		//read single fasta, single fastq and PE fasta in one file
 		else
@@ -795,7 +803,10 @@ int AIORead ( struct aiocb * mycb, int * offset, char * buf, char * cach, int *
 					*rt = aio_read ( mycb );
 					return 1;
 				}
-
+				else
+				{
+					fprintf(stderr, "Error: aio_return error.\n");
+				}
 				/*else
 				   {
 				   char *temp = (char *)((*mycb).aio_buf);
@@ -807,6 +818,10 @@ int AIORead ( struct aiocb * mycb, int * offset, char * buf, char * cach, int *
 			}
 		}
 	}
+	else
+	{
+		fprintf(stderr, "Error: (*rt != 0) in AIORead.\n");
+	}
 
 	return 0;
 }
diff --git a/standardPregraph/prlRead2path.c b/standardPregraph/prlRead2path.c
index 17994e4..f584e2a 100644
--- a/standardPregraph/prlRead2path.c
+++ b/standardPregraph/prlRead2path.c
@@ -832,7 +832,7 @@ void prlRead2edge ( char * libfile, char * outfile )
 	readBuffer1 = ( char * ) ckalloc ( ( maxAIOSize + ( maxReadLen * 4 + 1024 ) ) * sizeof ( char ) ); //(char *)ckalloc(maxAIOSize*sizeof(char)); //1024
 	readBuffer2 = ( char * ) ckalloc ( ( maxAIOSize + ( maxReadLen * 4 + 1024 ) ) * sizeof ( char ) ); //1024
 	cach1 = ( char * ) ckalloc ( ( maxReadLen * 4 + 1024 ) * sizeof ( char ) ); //1024
-	cach2 = ( char * ) ckalloc ( ( maxReadLen * 4 + 1024 ) * sizeof ( char ) ); //1024
+	cach2 = ( char * ) ckalloc ( ( maxReadLen * 4 + 1024 ) * sizeof ( char ) ); //1024 
 	memset ( cach1, '\0', ( maxReadLen * 4 + 1024 ) ); //1024
 	memset ( cach2, '\0', ( maxReadLen * 4 + 1024 ) ); //1024
 	seqBuffer = ( char ** ) ckalloc ( maxReadNum * sizeof ( char * ) );
@@ -1011,6 +1011,7 @@ void prlRead2edge ( char * libfile, char * outfile )
 							if ( start1 >= offset1 )
 							{
 								start1 = 0;
+								offset1 = 0;
 								flag1 = AIORead ( &aio1, &offset1, readBuffer1, cach1, &rt1, lib_array[libNo].curr_type );
 							}
 
@@ -1024,6 +1025,7 @@ void prlRead2edge ( char * libfile, char * outfile )
 						if ( start1 >= offset1 )
 						{
 							start1 = 0;
+							offset1 = 0;
 							flag1 = AIORead ( &aio1, &offset1, readBuffer1, cach1, &rt1, lib_array[libNo].curr_type );
 						}
 
@@ -1085,6 +1087,7 @@ void prlRead2edge ( char * libfile, char * outfile )
 							if ( start2 >= offset2 )
 							{
 								start2 = 0;
+								offset2 = 0;
 								flag2 = AIORead ( &aio2, &offset2, readBuffer2, cach2, &rt2, lib_array[libNo].curr_type );
 							}
 
@@ -1101,6 +1104,7 @@ void prlRead2edge ( char * libfile, char * outfile )
 						if ( start2 >= offset2 )
 						{
 							start2 = 0;
+							offset2 = 0;
 							flag2 = AIORead ( &aio2, &offset2, readBuffer2, cach2, &rt2, lib_array[libNo].curr_type );
 						}
 
@@ -1147,6 +1151,10 @@ void prlRead2edge ( char * libfile, char * outfile )
 					}
 				}
 			}
+			else
+			{
+				fprintf(stderr, "Error: aio_read error.\n");
+			}
 		}
 		else
 		{
diff --git a/standardPregraph/read2edge.c b/standardPregraph/read2edge.c
index 26cabe6..dcea79b 100644
--- a/standardPregraph/read2edge.c
+++ b/standardPregraph/read2edge.c
@@ -785,16 +785,19 @@ void Read2edge ( char * libfile, char * graph, int maxk )
 	file_type = ( int * ) ckalloc ( file_num * sizeof ( int ) );
 	file_maxReadLen = ( int * ) ckalloc ( file_num * sizeof ( int ) );
 	index = 0;
+	//2013-5-14
+	int maxReadLenLocal = 0;
 
 	for ( m = 0; m < num_libs; m++ )
 	{
 		if ( lib_array[m].asm_flag != 1 && lib_array[m].asm_flag != 3 )
 			{ continue; }
 
+		//2013-5-14
 		if ( lib_array[m].rd_len_cutoff > 0 )
-			{ maxReadLen = lib_array[m].rd_len_cutoff < maxReadLen4all ? lib_array[m].rd_len_cutoff : maxReadLen4all; }
+			{ maxReadLenLocal = lib_array[m].rd_len_cutoff < maxReadLen4all ? lib_array[m].rd_len_cutoff : maxReadLen4all; }
 		else
-			{ maxReadLen = maxReadLen4all; }
+			{ maxReadLenLocal = maxReadLen4all; }
 
 		//fa1 fa2
 		for ( n = 0; n < lib_array[m].num_a1_file; n++ )
@@ -802,19 +805,19 @@ void Read2edge ( char * libfile, char * graph, int maxk )
 			if ( strlen ( lib_array[m].a1_fname[n] ) > 3 && strcmp ( lib_array[m].a1_fname[n] + strlen ( lib_array[m].a1_fname[n] ) - 3, ".gz" ) == 0 )
 			{
 				file_type[index] = 3;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].a1_fname[n];
 				file_type[index] = 3;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].a2_fname[n];
 			}
 			else
 			{
 				file_type[index] = 1;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].a1_fname[n];
 				file_type[index] = 1;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].a2_fname[n];
 			}
 		}
@@ -825,19 +828,19 @@ void Read2edge ( char * libfile, char * graph, int maxk )
 			if ( strlen ( lib_array[m].q1_fname[n] ) > 3 && strcmp ( lib_array[m].q1_fname[n] + strlen ( lib_array[m].q1_fname[n] ) - 3, ".gz" ) == 0 )
 			{
 				file_type[index] = 4;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].q1_fname[n];
 				file_type[index] = 4;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].q2_fname[n];
 			}
 			else
 			{
 				file_type[index] = 2;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].q1_fname[n];
 				file_type[index] = 2;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].q2_fname[n];
 			}
 		}
@@ -848,13 +851,13 @@ void Read2edge ( char * libfile, char * graph, int maxk )
 			if ( strlen ( lib_array[m].p_fname[n] ) > 3 && strcmp ( lib_array[m].p_fname[n] + strlen ( lib_array[m].p_fname[n] ) - 3, ".gz" ) == 0 )
 			{
 				file_type[index] = 3;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].p_fname[n];
 			}
 			else
 			{
 				file_type[index] = 1;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].p_fname[n];
 			}
 		}
@@ -865,13 +868,13 @@ void Read2edge ( char * libfile, char * graph, int maxk )
 			if ( strlen ( lib_array[m].s_a_fname[n] ) > 3 && strcmp ( lib_array[m].s_a_fname[n] + strlen ( lib_array[m].s_a_fname[n] ) - 3, ".gz" ) == 0 )
 			{
 				file_type[index] = 3;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].s_a_fname[n];
 			}
 			else
 			{
 				file_type[index] = 1;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].s_a_fname[n];
 			}
 		}
@@ -882,13 +885,13 @@ void Read2edge ( char * libfile, char * graph, int maxk )
 			if ( strlen ( lib_array[m].s_q_fname[n] ) > 3 && strcmp ( lib_array[m].s_q_fname[n] + strlen ( lib_array[m].s_q_fname[n] ) - 3, ".gz" ) == 0 )
 			{
 				file_type[index] = 4;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].s_q_fname[n];
 			}
 			else
 			{
 				file_type[index] = 2;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].s_q_fname[n];
 			}
 		}
@@ -1255,6 +1258,8 @@ void Read2edge2 ( char * libfile, char * graph, int lastTime, int maxk )
 	file_type = ( int * ) ckalloc ( file_num * sizeof ( int ) );
 	file_maxReadLen = ( int * ) ckalloc ( file_num * sizeof ( int ) );
 	index = 0;
+	//2013-5-14
+	int maxReadLenLocal = 0;
 
 	for ( m = 0; m < num_libs; m++ )
 	{
@@ -1262,9 +1267,9 @@ void Read2edge2 ( char * libfile, char * graph, int lastTime, int maxk )
 			{ continue; }
 
 		if ( lib_array[m].rd_len_cutoff > 0 )
-			{ maxReadLen = lib_array[m].rd_len_cutoff < maxReadLen4all ? lib_array[m].rd_len_cutoff : maxReadLen4all; }
+			{ maxReadLenLocal = lib_array[m].rd_len_cutoff < maxReadLen4all ? lib_array[m].rd_len_cutoff : maxReadLen4all; }
 		else
-			{ maxReadLen = maxReadLen4all; }
+			{ maxReadLenLocal = maxReadLen4all; }
 
 		//fa1 fa2
 		for ( n = 0; n < lib_array[m].num_a1_file; n++ )
@@ -1272,19 +1277,19 @@ void Read2edge2 ( char * libfile, char * graph, int lastTime, int maxk )
 			if ( strlen ( lib_array[m].a1_fname[n] ) > 3 && strcmp ( lib_array[m].a1_fname[n] + strlen ( lib_array[m].a1_fname[n] ) - 3, ".gz" ) == 0 )
 			{
 				file_type[index] = 3;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].a1_fname[n];
 				file_type[index] = 3;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].a2_fname[n];
 			}
 			else
 			{
 				file_type[index] = 1;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].a1_fname[n];
 				file_type[index] = 1;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].a2_fname[n];
 			}
 		}
@@ -1295,19 +1300,19 @@ void Read2edge2 ( char * libfile, char * graph, int lastTime, int maxk )
 			if ( strlen ( lib_array[m].q1_fname[n] ) > 3 && strcmp ( lib_array[m].q1_fname[n] + strlen ( lib_array[m].q1_fname[n] ) - 3, ".gz" ) == 0 )
 			{
 				file_type[index] = 4;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].q1_fname[n];
 				file_type[index] = 4;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].q2_fname[n];
 			}
 			else
 			{
 				file_type[index] = 2;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].q1_fname[n];
 				file_type[index] = 2;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].q2_fname[n];
 			}
 		}
@@ -1318,13 +1323,13 @@ void Read2edge2 ( char * libfile, char * graph, int lastTime, int maxk )
 			if ( strlen ( lib_array[m].p_fname[n] ) > 3 && strcmp ( lib_array[m].p_fname[n] + strlen ( lib_array[m].p_fname[n] ) - 3, ".gz" ) == 0 )
 			{
 				file_type[index] = 3;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].p_fname[n];
 			}
 			else
 			{
 				file_type[index] = 1;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].p_fname[n];
 			}
 		}
@@ -1335,13 +1340,13 @@ void Read2edge2 ( char * libfile, char * graph, int lastTime, int maxk )
 			if ( strlen ( lib_array[m].s_a_fname[n] ) > 3 && strcmp ( lib_array[m].s_a_fname[n] + strlen ( lib_array[m].s_a_fname[n] ) - 3, ".gz" ) == 0 )
 			{
 				file_type[index] = 3;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].s_a_fname[n];
 			}
 			else
 			{
 				file_type[index] = 1;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].s_a_fname[n];
 			}
 		}
@@ -1352,13 +1357,13 @@ void Read2edge2 ( char * libfile, char * graph, int lastTime, int maxk )
 			if ( strlen ( lib_array[m].s_q_fname[n] ) > 3 && strcmp ( lib_array[m].s_q_fname[n] + strlen ( lib_array[m].s_q_fname[n] ) - 3, ".gz" ) == 0 )
 			{
 				file_type[index] = 4;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].s_q_fname[n];
 			}
 			else
 			{
 				file_type[index] = 2;
-				file_maxReadLen[index] = maxReadLen;
+				file_maxReadLen[index] = maxReadLenLocal;
 				file_Name[index++] = lib_array[m].s_q_fname[n];
 			}
 		}
diff --git a/standardPregraph/readseq1by1.c b/standardPregraph/readseq1by1.c
index fd626e8..9d0e655 100644
--- a/standardPregraph/readseq1by1.c
+++ b/standardPregraph/readseq1by1.c
@@ -958,7 +958,8 @@ boolean read1seqInLib ( char * src_seq, char * src_name, int * len_seq, int * li
 	if ( ( ( lib_array[i].curr_type != 4 ) && !lib_array[i].fp1 ) // file1 does not exist
 	        || ( ( lib_array[i].curr_type == 4 ) && ( lib_array[i].fp3 == NULL ) ) //file3 does not exist
 	        || ( ( lib_array[i].curr_type == 4 ) && readstate < 0 ) //file3 reaches end
-	        || ( ( lib_array[i].curr_type == 1 || lib_array[i].curr_type == 2 ) && feof ( lib_array[i].fp1 ) && feof ( lib_array[i].fp2 ) ) //f1&f2 reaches end
+	        || ( ( lib_array[i].curr_type == 1 ) && feof ( lib_array[i].fp1 ) && feof ( lib_array[i].fp2 ) ) //f1 && f2 reach end
+		|| ( ( lib_array[i].curr_type == 2 ) && ( feof ( lib_array[i].fp1 ) || feof ( lib_array[i].fp2 ) )) //f1||f2 reaches end
 	        || ( ( lib_array[i].curr_type != 1 && lib_array[i].curr_type != 2 ) && ( lib_array[i].curr_type != 4 ) && feof ( lib_array[i].fp1 ) ) ) // file1 reaches end and not type1 type2 and not type6
 	{
 		if ( lib_array[i].curr_type == 4 )
@@ -971,10 +972,23 @@ boolean read1seqInLib ( char * src_seq, char * src_name, int * len_seq, int * li
 		else
 		{
 			if ( lib_array[i].fp1 && feof ( lib_array[i].fp1 ) )
-				{ closeFp1InLab ( i ); }
+			{ 
+				closeFp1InLab ( i );
 
-			if ( lib_array[i].fp2 && feof ( lib_array[i].fp2 ) )
-				{ closeFp2InLab ( i ); }
+				if ( lib_array[i].fp2 )
+				{
+					closeFp2InLab ( i );
+				}
+			}
+			else if ( lib_array[i].fp2 && feof ( lib_array[i].fp2 ) )
+			{
+				closeFp2InLab ( i );
+
+				if ( lib_array[i].fp1 )
+				{
+					closeFp1InLab ( i );
+				}
+			}
 		}
 
 		*libNo = nextValidIndex ( i, pair, asm_ctg );
diff --git a/update.log b/update.log
index 8bbf37b..5f6e8b5 100644
--- a/update.log
+++ b/update.log
@@ -1,3 +1,30 @@
+r240 | 2013-07-09 11:30:03 +0800 (Tue, 09 Jul 2013)
+
+Fix a bug in reading files in 'map' step. This bug might lead to seg fault.
+
+------------------------------------------------------------------------
+r239 | 2013-06-26 09:41:39 +0800 (Wed, 26 Jun 2013)
+
+1) Fix the bug of reading fasta file in map step. This bug was introduced when
+   fixing a bug of reading fastq file in r238.
+
+------------------------------------------------------------------------
+r224 - r238 | 2013-06-13
+
+1) Fix a serious bug in 'map' step of version r223. This bug can lead
+   to incorrect pairing of PE reads in LIB of even order, e.g., the 
+   2nd LIB, the 4th LIB and so on...And these affected LIBs may not 
+   contribute to the construction of scaffold.
+2) Merge 'standPregraph' and 'sparsePregraph'. Now, there are only two 
+   executable programs: SOAPdenovo-63mer and SOAPdenovo-127mer. User 
+   can choose to use 'pregraph' for standard Kmer graph or 
+   'sparse_pregraph' for sparse Kmer graph.
+3) Add an option for debug version compilation. User can use 
+   'make debug=1' to obtain programs for debug.
+4) Fix a bug in sorting edges in 'contig' step.
+5) Fix a bug in reading files when using multi-kmer. Now the 
+   'max_read_length' will change according to the LIB being red.
+
 ------------------------------------------------------------------------
 r223 | 2012-12-28 10:11:43 +0800 (Fri, 28 Dec 2012) 
 

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



More information about the debian-med-commit mailing list