bio-velvet_underground 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.gitmodules +3 -0
- data/.travis.yml +13 -0
- data/Gemfile +19 -0
- data/LICENSE.txt +20 -0
- data/README.md +53 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/ext/bioruby.patch +60 -0
- data/ext/mkrf_conf.rb +50 -0
- data/ext/src/Makefile +125 -0
- data/ext/src/src/allocArray.c +305 -0
- data/ext/src/src/allocArray.h +86 -0
- data/ext/src/src/autoOpen.c +107 -0
- data/ext/src/src/autoOpen.h +18 -0
- data/ext/src/src/binarySequences.c +813 -0
- data/ext/src/src/binarySequences.h +125 -0
- data/ext/src/src/concatenatedGraph.c +233 -0
- data/ext/src/src/concatenatedGraph.h +30 -0
- data/ext/src/src/concatenatedPreGraph.c +262 -0
- data/ext/src/src/concatenatedPreGraph.h +29 -0
- data/ext/src/src/correctedGraph.c +2642 -0
- data/ext/src/src/correctedGraph.h +32 -0
- data/ext/src/src/dfib.c +509 -0
- data/ext/src/src/dfib.h +69 -0
- data/ext/src/src/dfibHeap.c +89 -0
- data/ext/src/src/dfibHeap.h +39 -0
- data/ext/src/src/dfibpriv.h +105 -0
- data/ext/src/src/fib.c +628 -0
- data/ext/src/src/fib.h +78 -0
- data/ext/src/src/fibHeap.c +79 -0
- data/ext/src/src/fibHeap.h +41 -0
- data/ext/src/src/fibpriv.h +110 -0
- data/ext/src/src/globals.h +153 -0
- data/ext/src/src/graph.c +3983 -0
- data/ext/src/src/graph.h +233 -0
- data/ext/src/src/graphReConstruction.c +1472 -0
- data/ext/src/src/graphReConstruction.h +30 -0
- data/ext/src/src/graphStats.c +2167 -0
- data/ext/src/src/graphStats.h +72 -0
- data/ext/src/src/kmer.c +652 -0
- data/ext/src/src/kmer.h +73 -0
- data/ext/src/src/kmerOccurenceTable.c +236 -0
- data/ext/src/src/kmerOccurenceTable.h +44 -0
- data/ext/src/src/kseq.h +223 -0
- data/ext/src/src/locallyCorrectedGraph.c +557 -0
- data/ext/src/src/locallyCorrectedGraph.h +40 -0
- data/ext/src/src/passageMarker.c +677 -0
- data/ext/src/src/passageMarker.h +137 -0
- data/ext/src/src/preGraph.c +1717 -0
- data/ext/src/src/preGraph.h +106 -0
- data/ext/src/src/preGraphConstruction.c +990 -0
- data/ext/src/src/preGraphConstruction.h +26 -0
- data/ext/src/src/readCoherentGraph.c +557 -0
- data/ext/src/src/readCoherentGraph.h +30 -0
- data/ext/src/src/readSet.c +1734 -0
- data/ext/src/src/readSet.h +67 -0
- data/ext/src/src/recycleBin.c +199 -0
- data/ext/src/src/recycleBin.h +58 -0
- data/ext/src/src/roadMap.c +342 -0
- data/ext/src/src/roadMap.h +65 -0
- data/ext/src/src/run.c +318 -0
- data/ext/src/src/run.h +52 -0
- data/ext/src/src/run2.c +712 -0
- data/ext/src/src/scaffold.c +1876 -0
- data/ext/src/src/scaffold.h +64 -0
- data/ext/src/src/shortReadPairs.c +1243 -0
- data/ext/src/src/shortReadPairs.h +32 -0
- data/ext/src/src/splay.c +259 -0
- data/ext/src/src/splay.h +43 -0
- data/ext/src/src/splayTable.c +1315 -0
- data/ext/src/src/splayTable.h +31 -0
- data/ext/src/src/tightString.c +362 -0
- data/ext/src/src/tightString.h +82 -0
- data/ext/src/src/utility.c +199 -0
- data/ext/src/src/utility.h +98 -0
- data/ext/src/third-party/zlib-1.2.3/ChangeLog +855 -0
- data/ext/src/third-party/zlib-1.2.3/FAQ +339 -0
- data/ext/src/third-party/zlib-1.2.3/INDEX +51 -0
- data/ext/src/third-party/zlib-1.2.3/Makefile +154 -0
- data/ext/src/third-party/zlib-1.2.3/Makefile.in +154 -0
- data/ext/src/third-party/zlib-1.2.3/README +125 -0
- data/ext/src/third-party/zlib-1.2.3/adler32.c +149 -0
- data/ext/src/third-party/zlib-1.2.3/algorithm.txt +209 -0
- data/ext/src/third-party/zlib-1.2.3/amiga/Makefile.pup +66 -0
- data/ext/src/third-party/zlib-1.2.3/amiga/Makefile.sas +65 -0
- data/ext/src/third-party/zlib-1.2.3/as400/bndsrc +132 -0
- data/ext/src/third-party/zlib-1.2.3/as400/compile.clp +123 -0
- data/ext/src/third-party/zlib-1.2.3/as400/readme.txt +111 -0
- data/ext/src/third-party/zlib-1.2.3/as400/zlib.inc +331 -0
- data/ext/src/third-party/zlib-1.2.3/compress.c +79 -0
- data/ext/src/third-party/zlib-1.2.3/configure +459 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/README.contrib +71 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/ada/buffer_demo.adb +106 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/ada/mtest.adb +156 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/ada/read.adb +156 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/ada/readme.txt +65 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/ada/test.adb +463 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/ada/zlib-streams.adb +225 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/ada/zlib-streams.ads +114 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/ada/zlib-thin.adb +141 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/ada/zlib-thin.ads +450 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/ada/zlib.adb +701 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/ada/zlib.ads +328 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/ada/zlib.gpr +20 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/asm586/README.586 +43 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/asm586/match.S +364 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/asm686/README.686 +34 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/asm686/match.S +329 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/blast/Makefile +8 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/blast/README +4 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/blast/blast.c +444 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/blast/blast.h +71 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/blast/test.pk +0 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/blast/test.txt +1 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/delphi/ZLib.pas +557 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/delphi/ZLibConst.pas +11 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/delphi/readme.txt +76 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/delphi/zlibd32.mak +93 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib.build +33 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib.chm +0 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib.sln +21 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/AssemblyInfo.cs +58 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/ChecksumImpl.cs +202 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/CircularBuffer.cs +83 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/CodecBase.cs +198 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/Deflater.cs +106 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/DotZLib.cs +288 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/DotZLib.csproj +141 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/GZipStream.cs +301 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/Inflater.cs +105 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/DotZLib/UnitTests.cs +274 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/LICENSE_1_0.txt +23 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/dotzlib/readme.txt +58 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/infback9/README +1 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/infback9/infback9.c +608 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/infback9/infback9.h +37 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/infback9/inffix9.h +107 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/infback9/inflate9.h +47 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/infback9/inftree9.c +323 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/infback9/inftree9.h +55 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/inflate86/inffas86.c +1157 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/inflate86/inffast.S +1368 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/iostream/test.cpp +24 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/iostream/zfstream.cpp +329 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/iostream/zfstream.h +128 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/iostream2/zstream.h +307 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/iostream2/zstream_test.cpp +25 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/iostream3/README +35 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/iostream3/TODO +17 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/iostream3/test.cc +50 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/iostream3/zfstream.cc +479 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/iostream3/zfstream.h +466 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/masm686/match.asm +413 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/masmx64/bld_ml64.bat +2 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/masmx64/gvmat64.asm +513 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/masmx64/gvmat64.obj +0 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/masmx64/inffas8664.c +186 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/masmx64/inffasx64.asm +392 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/masmx64/inffasx64.obj +0 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/masmx64/readme.txt +28 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/masmx86/bld_ml32.bat +2 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/masmx86/gvmat32.asm +972 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/masmx86/gvmat32.obj +0 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/masmx86/gvmat32c.c +62 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/masmx86/inffas32.asm +1083 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/masmx86/inffas32.obj +0 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/masmx86/mkasm.bat +3 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/masmx86/readme.txt +21 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/minizip/ChangeLogUnzip +67 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/minizip/Makefile +25 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/minizip/crypt.h +132 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/minizip/ioapi.c +177 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/minizip/ioapi.h +75 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/minizip/iowin32.c +270 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/minizip/iowin32.h +21 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/minizip/miniunz.c +585 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/minizip/minizip.c +420 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/minizip/mztools.c +281 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/minizip/mztools.h +31 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/minizip/unzip.c +1598 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/minizip/unzip.h +354 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/minizip/zip.c +1219 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/minizip/zip.h +235 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/pascal/example.pas +599 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/pascal/readme.txt +76 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/pascal/zlibd32.mak +93 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/pascal/zlibpas.pas +236 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/puff/Makefile +8 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/puff/README +63 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/puff/puff.c +837 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/puff/puff.h +31 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/puff/zeros.raw +0 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/testzlib/testzlib.c +275 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/testzlib/testzlib.txt +10 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/untgz/Makefile +14 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/untgz/Makefile.msc +17 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/untgz/untgz.c +674 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/readme.txt +73 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc7/miniunz.vcproj +126 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc7/minizip.vcproj +126 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc7/testzlib.vcproj +126 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc7/zlib.rc +32 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc7/zlibstat.vcproj +246 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.def +92 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.sln +78 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.vcproj +445 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/miniunz.vcproj +566 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/minizip.vcproj +563 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/testzlib.vcproj +948 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/testzlibdll.vcproj +567 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/zlib.rc +32 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/zlibstat.vcproj +870 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.def +92 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.sln +144 -0
- data/ext/src/third-party/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.vcproj +1219 -0
- data/ext/src/third-party/zlib-1.2.3/crc32.c +423 -0
- data/ext/src/third-party/zlib-1.2.3/crc32.h +441 -0
- data/ext/src/third-party/zlib-1.2.3/deflate.c +1736 -0
- data/ext/src/third-party/zlib-1.2.3/deflate.h +331 -0
- data/ext/src/third-party/zlib-1.2.3/example.c +565 -0
- data/ext/src/third-party/zlib-1.2.3/examples/README.examples +42 -0
- data/ext/src/third-party/zlib-1.2.3/examples/fitblk.c +233 -0
- data/ext/src/third-party/zlib-1.2.3/examples/gun.c +693 -0
- data/ext/src/third-party/zlib-1.2.3/examples/gzappend.c +500 -0
- data/ext/src/third-party/zlib-1.2.3/examples/gzjoin.c +448 -0
- data/ext/src/third-party/zlib-1.2.3/examples/gzlog.c +413 -0
- data/ext/src/third-party/zlib-1.2.3/examples/gzlog.h +58 -0
- data/ext/src/third-party/zlib-1.2.3/examples/zlib_how.html +523 -0
- data/ext/src/third-party/zlib-1.2.3/examples/zpipe.c +191 -0
- data/ext/src/third-party/zlib-1.2.3/examples/zran.c +404 -0
- data/ext/src/third-party/zlib-1.2.3/gzio.c +1026 -0
- data/ext/src/third-party/zlib-1.2.3/infback.c +623 -0
- data/ext/src/third-party/zlib-1.2.3/inffast.c +318 -0
- data/ext/src/third-party/zlib-1.2.3/inffast.h +11 -0
- data/ext/src/third-party/zlib-1.2.3/inffixed.h +94 -0
- data/ext/src/third-party/zlib-1.2.3/inflate.c +1368 -0
- data/ext/src/third-party/zlib-1.2.3/inflate.h +115 -0
- data/ext/src/third-party/zlib-1.2.3/inftrees.c +329 -0
- data/ext/src/third-party/zlib-1.2.3/inftrees.h +55 -0
- data/ext/src/third-party/zlib-1.2.3/make_vms.com +461 -0
- data/ext/src/third-party/zlib-1.2.3/minigzip.c +322 -0
- data/ext/src/third-party/zlib-1.2.3/msdos/Makefile.bor +109 -0
- data/ext/src/third-party/zlib-1.2.3/msdos/Makefile.dj2 +104 -0
- data/ext/src/third-party/zlib-1.2.3/msdos/Makefile.emx +69 -0
- data/ext/src/third-party/zlib-1.2.3/msdos/Makefile.msc +106 -0
- data/ext/src/third-party/zlib-1.2.3/msdos/Makefile.tc +94 -0
- data/ext/src/third-party/zlib-1.2.3/old/Makefile.riscos +151 -0
- data/ext/src/third-party/zlib-1.2.3/old/README +3 -0
- data/ext/src/third-party/zlib-1.2.3/old/descrip.mms +48 -0
- data/ext/src/third-party/zlib-1.2.3/old/os2/Makefile.os2 +136 -0
- data/ext/src/third-party/zlib-1.2.3/old/os2/zlib.def +51 -0
- data/ext/src/third-party/zlib-1.2.3/old/visual-basic.txt +160 -0
- data/ext/src/third-party/zlib-1.2.3/old/zlib.html +971 -0
- data/ext/src/third-party/zlib-1.2.3/projects/README.projects +41 -0
- data/ext/src/third-party/zlib-1.2.3/projects/visualc6/README.txt +73 -0
- data/ext/src/third-party/zlib-1.2.3/projects/visualc6/example.dsp +278 -0
- data/ext/src/third-party/zlib-1.2.3/projects/visualc6/minigzip.dsp +278 -0
- data/ext/src/third-party/zlib-1.2.3/projects/visualc6/zlib.dsp +609 -0
- data/ext/src/third-party/zlib-1.2.3/projects/visualc6/zlib.dsw +59 -0
- data/ext/src/third-party/zlib-1.2.3/qnx/package.qpg +141 -0
- data/ext/src/third-party/zlib-1.2.3/trees.c +1219 -0
- data/ext/src/third-party/zlib-1.2.3/trees.h +128 -0
- data/ext/src/third-party/zlib-1.2.3/uncompr.c +61 -0
- data/ext/src/third-party/zlib-1.2.3/win32/DLL_FAQ.txt +397 -0
- data/ext/src/third-party/zlib-1.2.3/win32/Makefile.bor +107 -0
- data/ext/src/third-party/zlib-1.2.3/win32/Makefile.emx +69 -0
- data/ext/src/third-party/zlib-1.2.3/win32/Makefile.gcc +141 -0
- data/ext/src/third-party/zlib-1.2.3/win32/Makefile.msc +126 -0
- data/ext/src/third-party/zlib-1.2.3/win32/VisualC.txt +3 -0
- data/ext/src/third-party/zlib-1.2.3/win32/zlib.def +60 -0
- data/ext/src/third-party/zlib-1.2.3/win32/zlib1.rc +39 -0
- data/ext/src/third-party/zlib-1.2.3/zconf.h +332 -0
- data/ext/src/third-party/zlib-1.2.3/zconf.in.h +332 -0
- data/ext/src/third-party/zlib-1.2.3/zlib.3 +159 -0
- data/ext/src/third-party/zlib-1.2.3/zlib.h +1357 -0
- data/ext/src/third-party/zlib-1.2.3/zutil.c +318 -0
- data/ext/src/third-party/zlib-1.2.3/zutil.h +269 -0
- data/lib/bio-velvet_underground.rb +12 -0
- data/lib/bio-velvet_underground/external/VERSION +1 -0
- data/lib/bio-velvet_underground/velvet_underground.rb +72 -0
- data/spec/binary_sequence_store_spec.rb +27 -0
- data/spec/data/1/CnyUnifiedSeq +0 -0
- data/spec/spec_helper.rb +31 -0
- metadata +456 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
#include "zfstream.h"
|
3
|
+
|
4
|
+
int main() {
|
5
|
+
|
6
|
+
// Construct a stream object with this filebuffer. Anything sent
|
7
|
+
// to this stream will go to standard out.
|
8
|
+
gzofstream os( 1, ios::out );
|
9
|
+
|
10
|
+
// This text is getting compressed and sent to stdout.
|
11
|
+
// To prove this, run 'test | zcat'.
|
12
|
+
os << "Hello, Mommy" << endl;
|
13
|
+
|
14
|
+
os << setcompressionlevel( Z_NO_COMPRESSION );
|
15
|
+
os << "hello, hello, hi, ho!" << endl;
|
16
|
+
|
17
|
+
setcompressionlevel( os, Z_DEFAULT_COMPRESSION )
|
18
|
+
<< "I'm compressing again" << endl;
|
19
|
+
|
20
|
+
os.close();
|
21
|
+
|
22
|
+
return 0;
|
23
|
+
|
24
|
+
}
|
@@ -0,0 +1,329 @@
|
|
1
|
+
|
2
|
+
#include "zfstream.h"
|
3
|
+
|
4
|
+
gzfilebuf::gzfilebuf() :
|
5
|
+
file(NULL),
|
6
|
+
mode(0),
|
7
|
+
own_file_descriptor(0)
|
8
|
+
{ }
|
9
|
+
|
10
|
+
gzfilebuf::~gzfilebuf() {
|
11
|
+
|
12
|
+
sync();
|
13
|
+
if ( own_file_descriptor )
|
14
|
+
close();
|
15
|
+
|
16
|
+
}
|
17
|
+
|
18
|
+
gzfilebuf *gzfilebuf::open( const char *name,
|
19
|
+
int io_mode ) {
|
20
|
+
|
21
|
+
if ( is_open() )
|
22
|
+
return NULL;
|
23
|
+
|
24
|
+
char char_mode[10];
|
25
|
+
char *p = char_mode;
|
26
|
+
|
27
|
+
if ( io_mode & ios::in ) {
|
28
|
+
mode = ios::in;
|
29
|
+
*p++ = 'r';
|
30
|
+
} else if ( io_mode & ios::app ) {
|
31
|
+
mode = ios::app;
|
32
|
+
*p++ = 'a';
|
33
|
+
} else {
|
34
|
+
mode = ios::out;
|
35
|
+
*p++ = 'w';
|
36
|
+
}
|
37
|
+
|
38
|
+
if ( io_mode & ios::binary ) {
|
39
|
+
mode |= ios::binary;
|
40
|
+
*p++ = 'b';
|
41
|
+
}
|
42
|
+
|
43
|
+
// Hard code the compression level
|
44
|
+
if ( io_mode & (ios::out|ios::app )) {
|
45
|
+
*p++ = '9';
|
46
|
+
}
|
47
|
+
|
48
|
+
// Put the end-of-string indicator
|
49
|
+
*p = '\0';
|
50
|
+
|
51
|
+
if ( (file = gzopen(name, char_mode)) == NULL )
|
52
|
+
return NULL;
|
53
|
+
|
54
|
+
own_file_descriptor = 1;
|
55
|
+
|
56
|
+
return this;
|
57
|
+
|
58
|
+
}
|
59
|
+
|
60
|
+
gzfilebuf *gzfilebuf::attach( int file_descriptor,
|
61
|
+
int io_mode ) {
|
62
|
+
|
63
|
+
if ( is_open() )
|
64
|
+
return NULL;
|
65
|
+
|
66
|
+
char char_mode[10];
|
67
|
+
char *p = char_mode;
|
68
|
+
|
69
|
+
if ( io_mode & ios::in ) {
|
70
|
+
mode = ios::in;
|
71
|
+
*p++ = 'r';
|
72
|
+
} else if ( io_mode & ios::app ) {
|
73
|
+
mode = ios::app;
|
74
|
+
*p++ = 'a';
|
75
|
+
} else {
|
76
|
+
mode = ios::out;
|
77
|
+
*p++ = 'w';
|
78
|
+
}
|
79
|
+
|
80
|
+
if ( io_mode & ios::binary ) {
|
81
|
+
mode |= ios::binary;
|
82
|
+
*p++ = 'b';
|
83
|
+
}
|
84
|
+
|
85
|
+
// Hard code the compression level
|
86
|
+
if ( io_mode & (ios::out|ios::app )) {
|
87
|
+
*p++ = '9';
|
88
|
+
}
|
89
|
+
|
90
|
+
// Put the end-of-string indicator
|
91
|
+
*p = '\0';
|
92
|
+
|
93
|
+
if ( (file = gzdopen(file_descriptor, char_mode)) == NULL )
|
94
|
+
return NULL;
|
95
|
+
|
96
|
+
own_file_descriptor = 0;
|
97
|
+
|
98
|
+
return this;
|
99
|
+
|
100
|
+
}
|
101
|
+
|
102
|
+
gzfilebuf *gzfilebuf::close() {
|
103
|
+
|
104
|
+
if ( is_open() ) {
|
105
|
+
|
106
|
+
sync();
|
107
|
+
gzclose( file );
|
108
|
+
file = NULL;
|
109
|
+
|
110
|
+
}
|
111
|
+
|
112
|
+
return this;
|
113
|
+
|
114
|
+
}
|
115
|
+
|
116
|
+
int gzfilebuf::setcompressionlevel( int comp_level ) {
|
117
|
+
|
118
|
+
return gzsetparams(file, comp_level, -2);
|
119
|
+
|
120
|
+
}
|
121
|
+
|
122
|
+
int gzfilebuf::setcompressionstrategy( int comp_strategy ) {
|
123
|
+
|
124
|
+
return gzsetparams(file, -2, comp_strategy);
|
125
|
+
|
126
|
+
}
|
127
|
+
|
128
|
+
|
129
|
+
streampos gzfilebuf::seekoff( streamoff off, ios::seek_dir dir, int which ) {
|
130
|
+
|
131
|
+
return streampos(EOF);
|
132
|
+
|
133
|
+
}
|
134
|
+
|
135
|
+
int gzfilebuf::underflow() {
|
136
|
+
|
137
|
+
// If the file hasn't been opened for reading, error.
|
138
|
+
if ( !is_open() || !(mode & ios::in) )
|
139
|
+
return EOF;
|
140
|
+
|
141
|
+
// if a buffer doesn't exists, allocate one.
|
142
|
+
if ( !base() ) {
|
143
|
+
|
144
|
+
if ( (allocate()) == EOF )
|
145
|
+
return EOF;
|
146
|
+
setp(0,0);
|
147
|
+
|
148
|
+
} else {
|
149
|
+
|
150
|
+
if ( in_avail() )
|
151
|
+
return (unsigned char) *gptr();
|
152
|
+
|
153
|
+
if ( out_waiting() ) {
|
154
|
+
if ( flushbuf() == EOF )
|
155
|
+
return EOF;
|
156
|
+
}
|
157
|
+
|
158
|
+
}
|
159
|
+
|
160
|
+
// Attempt to fill the buffer.
|
161
|
+
|
162
|
+
int result = fillbuf();
|
163
|
+
if ( result == EOF ) {
|
164
|
+
// disable get area
|
165
|
+
setg(0,0,0);
|
166
|
+
return EOF;
|
167
|
+
}
|
168
|
+
|
169
|
+
return (unsigned char) *gptr();
|
170
|
+
|
171
|
+
}
|
172
|
+
|
173
|
+
int gzfilebuf::overflow( int c ) {
|
174
|
+
|
175
|
+
if ( !is_open() || !(mode & ios::out) )
|
176
|
+
return EOF;
|
177
|
+
|
178
|
+
if ( !base() ) {
|
179
|
+
if ( allocate() == EOF )
|
180
|
+
return EOF;
|
181
|
+
setg(0,0,0);
|
182
|
+
} else {
|
183
|
+
if (in_avail()) {
|
184
|
+
return EOF;
|
185
|
+
}
|
186
|
+
if (out_waiting()) {
|
187
|
+
if (flushbuf() == EOF)
|
188
|
+
return EOF;
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
192
|
+
int bl = blen();
|
193
|
+
setp( base(), base() + bl);
|
194
|
+
|
195
|
+
if ( c != EOF ) {
|
196
|
+
|
197
|
+
*pptr() = c;
|
198
|
+
pbump(1);
|
199
|
+
|
200
|
+
}
|
201
|
+
|
202
|
+
return 0;
|
203
|
+
|
204
|
+
}
|
205
|
+
|
206
|
+
int gzfilebuf::sync() {
|
207
|
+
|
208
|
+
if ( !is_open() )
|
209
|
+
return EOF;
|
210
|
+
|
211
|
+
if ( out_waiting() )
|
212
|
+
return flushbuf();
|
213
|
+
|
214
|
+
return 0;
|
215
|
+
|
216
|
+
}
|
217
|
+
|
218
|
+
int gzfilebuf::flushbuf() {
|
219
|
+
|
220
|
+
int n;
|
221
|
+
char *q;
|
222
|
+
|
223
|
+
q = pbase();
|
224
|
+
n = pptr() - q;
|
225
|
+
|
226
|
+
if ( gzwrite( file, q, n) < n )
|
227
|
+
return EOF;
|
228
|
+
|
229
|
+
setp(0,0);
|
230
|
+
|
231
|
+
return 0;
|
232
|
+
|
233
|
+
}
|
234
|
+
|
235
|
+
int gzfilebuf::fillbuf() {
|
236
|
+
|
237
|
+
int required;
|
238
|
+
char *p;
|
239
|
+
|
240
|
+
p = base();
|
241
|
+
|
242
|
+
required = blen();
|
243
|
+
|
244
|
+
int t = gzread( file, p, required );
|
245
|
+
|
246
|
+
if ( t <= 0) return EOF;
|
247
|
+
|
248
|
+
setg( base(), base(), base()+t);
|
249
|
+
|
250
|
+
return t;
|
251
|
+
|
252
|
+
}
|
253
|
+
|
254
|
+
gzfilestream_common::gzfilestream_common() :
|
255
|
+
ios( gzfilestream_common::rdbuf() )
|
256
|
+
{ }
|
257
|
+
|
258
|
+
gzfilestream_common::~gzfilestream_common()
|
259
|
+
{ }
|
260
|
+
|
261
|
+
void gzfilestream_common::attach( int fd, int io_mode ) {
|
262
|
+
|
263
|
+
if ( !buffer.attach( fd, io_mode) )
|
264
|
+
clear( ios::failbit | ios::badbit );
|
265
|
+
else
|
266
|
+
clear();
|
267
|
+
|
268
|
+
}
|
269
|
+
|
270
|
+
void gzfilestream_common::open( const char *name, int io_mode ) {
|
271
|
+
|
272
|
+
if ( !buffer.open( name, io_mode ) )
|
273
|
+
clear( ios::failbit | ios::badbit );
|
274
|
+
else
|
275
|
+
clear();
|
276
|
+
|
277
|
+
}
|
278
|
+
|
279
|
+
void gzfilestream_common::close() {
|
280
|
+
|
281
|
+
if ( !buffer.close() )
|
282
|
+
clear( ios::failbit | ios::badbit );
|
283
|
+
|
284
|
+
}
|
285
|
+
|
286
|
+
gzfilebuf *gzfilestream_common::rdbuf()
|
287
|
+
{
|
288
|
+
return &buffer;
|
289
|
+
}
|
290
|
+
|
291
|
+
gzifstream::gzifstream() :
|
292
|
+
ios( gzfilestream_common::rdbuf() )
|
293
|
+
{
|
294
|
+
clear( ios::badbit );
|
295
|
+
}
|
296
|
+
|
297
|
+
gzifstream::gzifstream( const char *name, int io_mode ) :
|
298
|
+
ios( gzfilestream_common::rdbuf() )
|
299
|
+
{
|
300
|
+
gzfilestream_common::open( name, io_mode );
|
301
|
+
}
|
302
|
+
|
303
|
+
gzifstream::gzifstream( int fd, int io_mode ) :
|
304
|
+
ios( gzfilestream_common::rdbuf() )
|
305
|
+
{
|
306
|
+
gzfilestream_common::attach( fd, io_mode );
|
307
|
+
}
|
308
|
+
|
309
|
+
gzifstream::~gzifstream() { }
|
310
|
+
|
311
|
+
gzofstream::gzofstream() :
|
312
|
+
ios( gzfilestream_common::rdbuf() )
|
313
|
+
{
|
314
|
+
clear( ios::badbit );
|
315
|
+
}
|
316
|
+
|
317
|
+
gzofstream::gzofstream( const char *name, int io_mode ) :
|
318
|
+
ios( gzfilestream_common::rdbuf() )
|
319
|
+
{
|
320
|
+
gzfilestream_common::open( name, io_mode );
|
321
|
+
}
|
322
|
+
|
323
|
+
gzofstream::gzofstream( int fd, int io_mode ) :
|
324
|
+
ios( gzfilestream_common::rdbuf() )
|
325
|
+
{
|
326
|
+
gzfilestream_common::attach( fd, io_mode );
|
327
|
+
}
|
328
|
+
|
329
|
+
gzofstream::~gzofstream() { }
|
@@ -0,0 +1,128 @@
|
|
1
|
+
|
2
|
+
#ifndef zfstream_h
|
3
|
+
#define zfstream_h
|
4
|
+
|
5
|
+
#include <fstream.h>
|
6
|
+
#include "zlib.h"
|
7
|
+
|
8
|
+
class gzfilebuf : public streambuf {
|
9
|
+
|
10
|
+
public:
|
11
|
+
|
12
|
+
gzfilebuf( );
|
13
|
+
virtual ~gzfilebuf();
|
14
|
+
|
15
|
+
gzfilebuf *open( const char *name, int io_mode );
|
16
|
+
gzfilebuf *attach( int file_descriptor, int io_mode );
|
17
|
+
gzfilebuf *close();
|
18
|
+
|
19
|
+
int setcompressionlevel( int comp_level );
|
20
|
+
int setcompressionstrategy( int comp_strategy );
|
21
|
+
|
22
|
+
inline int is_open() const { return (file !=NULL); }
|
23
|
+
|
24
|
+
virtual streampos seekoff( streamoff, ios::seek_dir, int );
|
25
|
+
|
26
|
+
virtual int sync();
|
27
|
+
|
28
|
+
protected:
|
29
|
+
|
30
|
+
virtual int underflow();
|
31
|
+
virtual int overflow( int = EOF );
|
32
|
+
|
33
|
+
private:
|
34
|
+
|
35
|
+
gzFile file;
|
36
|
+
short mode;
|
37
|
+
short own_file_descriptor;
|
38
|
+
|
39
|
+
int flushbuf();
|
40
|
+
int fillbuf();
|
41
|
+
|
42
|
+
};
|
43
|
+
|
44
|
+
class gzfilestream_common : virtual public ios {
|
45
|
+
|
46
|
+
friend class gzifstream;
|
47
|
+
friend class gzofstream;
|
48
|
+
friend gzofstream &setcompressionlevel( gzofstream &, int );
|
49
|
+
friend gzofstream &setcompressionstrategy( gzofstream &, int );
|
50
|
+
|
51
|
+
public:
|
52
|
+
virtual ~gzfilestream_common();
|
53
|
+
|
54
|
+
void attach( int fd, int io_mode );
|
55
|
+
void open( const char *name, int io_mode );
|
56
|
+
void close();
|
57
|
+
|
58
|
+
protected:
|
59
|
+
gzfilestream_common();
|
60
|
+
|
61
|
+
private:
|
62
|
+
gzfilebuf *rdbuf();
|
63
|
+
|
64
|
+
gzfilebuf buffer;
|
65
|
+
|
66
|
+
};
|
67
|
+
|
68
|
+
class gzifstream : public gzfilestream_common, public istream {
|
69
|
+
|
70
|
+
public:
|
71
|
+
|
72
|
+
gzifstream();
|
73
|
+
gzifstream( const char *name, int io_mode = ios::in );
|
74
|
+
gzifstream( int fd, int io_mode = ios::in );
|
75
|
+
|
76
|
+
virtual ~gzifstream();
|
77
|
+
|
78
|
+
};
|
79
|
+
|
80
|
+
class gzofstream : public gzfilestream_common, public ostream {
|
81
|
+
|
82
|
+
public:
|
83
|
+
|
84
|
+
gzofstream();
|
85
|
+
gzofstream( const char *name, int io_mode = ios::out );
|
86
|
+
gzofstream( int fd, int io_mode = ios::out );
|
87
|
+
|
88
|
+
virtual ~gzofstream();
|
89
|
+
|
90
|
+
};
|
91
|
+
|
92
|
+
template<class T> class gzomanip {
|
93
|
+
friend gzofstream &operator<<(gzofstream &, const gzomanip<T> &);
|
94
|
+
public:
|
95
|
+
gzomanip(gzofstream &(*f)(gzofstream &, T), T v) : func(f), val(v) { }
|
96
|
+
private:
|
97
|
+
gzofstream &(*func)(gzofstream &, T);
|
98
|
+
T val;
|
99
|
+
};
|
100
|
+
|
101
|
+
template<class T> gzofstream &operator<<(gzofstream &s, const gzomanip<T> &m)
|
102
|
+
{
|
103
|
+
return (*m.func)(s, m.val);
|
104
|
+
}
|
105
|
+
|
106
|
+
inline gzofstream &setcompressionlevel( gzofstream &s, int l )
|
107
|
+
{
|
108
|
+
(s.rdbuf())->setcompressionlevel(l);
|
109
|
+
return s;
|
110
|
+
}
|
111
|
+
|
112
|
+
inline gzofstream &setcompressionstrategy( gzofstream &s, int l )
|
113
|
+
{
|
114
|
+
(s.rdbuf())->setcompressionstrategy(l);
|
115
|
+
return s;
|
116
|
+
}
|
117
|
+
|
118
|
+
inline gzomanip<int> setcompressionlevel(int l)
|
119
|
+
{
|
120
|
+
return gzomanip<int>(&setcompressionlevel,l);
|
121
|
+
}
|
122
|
+
|
123
|
+
inline gzomanip<int> setcompressionstrategy(int l)
|
124
|
+
{
|
125
|
+
return gzomanip<int>(&setcompressionstrategy,l);
|
126
|
+
}
|
127
|
+
|
128
|
+
#endif
|