' where"
@ echo "config = { "$(CONFIG)" }."
@ echo
.PHONY: help configure
sra_sdk-2.1.7/README 0000664 0012213 0011620 00000005224 11632420742 013521 0 ustar rodarmer trace # ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
The NCBI SRA ( Sequence Read Archive )
Contact: sra-tools@ncbi.nlm.nih.gov
http://trace.ncbi.nlm.nih.gov/Traces/sra/std
The SRA Toolkit and SDK from NCBI is a collection of tools and
libraries for using data in the INSDC Sequence Read Archives.
With this release, NCBI has implemented Compression by Reference, a
sequence alignment compression process for storing sequence data.
Currently BAM, Complete Genomics and Illumina export.txt formats
contain alignment information. Compression by Reference only stores
the difference in base pairs between sequence data and the segments it
aligns to. The decompression process to restore original data such as
fastq-dump would require fast access to the actual sequences of the
references. NCBI recommends that SRA users dedicate local disk space
to store local references downloaded from the NCBI SRA site. Linked
references should be in a location accessible by the SRA Reader
software.
Older files in the NCBI system may not have been compressed using
Compression by Reference. For more information on how to use
Reference-based compressed files, download local references, and use
related tools please refer to Compression by Reference file on the
NCBI SRA website:
"http://trace.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=softwareReadme"
For additional information on using and building the toolkit,
please visit our web site at:
"http://trace.ncbi.nlm.nih.gov/Traces/sra/std"
SRA Toolkit Development Team
sra_sdk-2.1.7/USAGE 0000644 0012213 0011620 00000015671 11645370373 013445 0 ustar rodarmer trace # ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
The NCBI SRA ( Sequence Read Archive ) Toolkit
Contact: sra-tools@ncbi.nlm.nih.gov
http://trace.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=software
For preliminary documentation on tool usage, consult the files within
the "help" directory.
CHANGES:
SRA Toolkit includes new features in sam-dump tool and vdb-dump tools.
Sam-dump now supports slicing across multiple sequences, and dumping cSRA files to fasta and fastq formats. In addition, sam-dump has three new parameters
-=|--hide-identical Output '=' if base is identical to reference
--gzip Compress output using gzip
--bzip2 Compress output using bzip2
vdb-dump has two new parameters
-o|--column_enum_short enumerates columns in short form
-b|--boolean defines how boolean's are printed (1,T)
We have combined the functionality of two scripts, config-assistant.perl and reference-assistant.perl into a single script, configuration-assistant.perl that helps users download the correct references for a given cSRA file and configure the user environment for the SRA Toolkit.
DESCRIPTION:
This release includes tools for reading the SRA archive, generally
by converting individual runs into some commonly used format such as
fastq. Support for NCBI's Compression by Reference is also included.
"Linux" binaries have been created on CentOS and SuSE Linux
distributions. They are not guaranteed to work on other
distributions. In particular, the version of libc.so should be
compatible. They are specific to the x86-family architectures.
"Windows" binaries have been created using MSVC's (not Cygwin)
tools. This release includes Win32 binaries. The "*-load" tools
are not released for "Windows".
"Mac OS X" binaries are available for the x86-family
architectures. They will NOT run on PPC Macs. The 64-bit binaries
will run only on OS 10.6. The 32-bit binaries should run on either
10.5 or later.
CONTENTS:
"abi-dump" - dump ABI color-space runs into their native format
"abi-load" - load ABI color-space runs
"fastq-dump" - dump any run of any platform in FASTQ format
"fastq-load" - load FASTQ runs
"helicos-load" - load HELICOS runs
"illumina-dump" - dump Illumina runs into their native format
"illumina-load" - load Illumina native runs
"kar" - an archive extraction tool for .sra files
"kdbmeta" - display the contents of one or more metadata stores
"rcexplain" - print out error string for return codes (RC)
"refseq-load" - ( NEW for Linux and Mac ) download a reference
sequence object
"sff-dump" - dump 454 runs into SFF format
"sff-load" - load 454 SFF runs
"sra-dbcc" - check SRA runs
"sra-dump" - dump any run in a textual format [see note below]
"sra-kar" - creates a single file archive from an SRA run
"sra-stat" - display run column statistics
"srf-load" - load SRF runs
"sam-dump" - dump a cSRA into the SAM-format
"vdb-copy" - copy SRA objects
"vdb-dump" - display SRA objects in a textual format [see note below]
"vdb-lock" - lock an object against modification
"vdb-unlock" - unlock an object
"align-info" - displays which references a csra-archive uses
"vdb-config" - displays the configuration
NOTES:
The "sam-dump" tool only works on cSRA's. ( See README-csra )
The textual dumpers "sra-dump" and "vdb-dump" are provided in this
release as an aid in visual inspection. It is likely that their
actual output formatting will be changed in the near future to a
stricter, more formalized representation[s].
The "help" information will be improved in near future releases, and
the tool options will become standardized across the set. We will
also be providing documentation on our web site.
Tool options may change in the next release. Version 1 tool options
will remain supported wherever possible in order to preserve
operation of any existing scripts.
CAVEATS:
SRA tools are designed to handle very large amounts of data, and are
not currently oriented toward desktop use. They work well within any
Unix-like environment, such as Linux or MacOS's BSD shell.
Windows operation presents a few challenges. We have tested our
binaries under the MS "cmd.exe" shell and Cygwin's bash. Our tools
know how to accept paths in Windows, Cygwin, POSIX and MinGW
formats. Internally, all paths are treated as MinGW-style POSIX
paths, so any information appearing in output will reflect this
conversion:
# simple file names
SRR012345.sra => [NO CHANGE]
# relative paths
win\SRR012345.sra => win/SRR012345.sra
# full or drive-relative paths
C:\sra\win\SRR012345.sra => /C/sra/win/SRR012345.sra
# network paths
\\server\sra\SRR012345.sra => //server/sra/SRR012345.sra
# POSIX paths
/sra/posix/SRR012345.sra => [NO CHANGE]
# Cygwin full paths
/cygdrive/C/sra/SRR012345.sra => /C/sra/SRR012345.sra
There are some situations where the software may behave unexpectedly
due to path conversions. In particular, since Windows does not
conform to POSIX path conventions, there may be difficulties
combining network paths with non-network paths, explicitly or
implicitly. IF YOU HAVE PROBLEMS, we recommend mounting file servers
as network drives.
If you run the software under Cygwin, you should take care to use
either relative paths (those that do not begin with '/') or full
paths that start with "/cygdrive/". The reason is that Cygwin
provides its own path manipulation, but our tools are not aware of
which shell they are running under.
sra_sdk-2.1.7/build/ 0000775 0012213 0011620 00000000000 11630164537 013742 5 ustar rodarmer trace sra_sdk-2.1.7/build/Makefile.env 0000644 0012213 0011620 00000016540 11627507615 016201 0 ustar rodarmer trace # ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# pick up dependencies from object directory
ifdef SRCDIR
include $(wildcard *.d)
endif
# determine shell environment
include $(TOP)/build/Makefile.shell
# normally build shared and static external libs
LIBEXT = $(LIBX) $(SHLX)
# normally build static intermediate libs
ILIBEXT = $(LIBX)
# only build dynamic library modules
MODEXT = $(SHLX)
# determine BUILD
ifeq (,$(BUILD))
BUILD = dbg
endif
# some rules are sensitive to the type of build
BUILDTYPE = $(BUILD)
# adjust settings for build
ifeq (dbg,$(BUILD))
DEBUG := -D_DEBUGGING
# ILIBEXT = $(LIBX) $(SHLX)
MODEXT = $(LIBX) $(SHLX)
endif
ifeq (rel,$(BUILD))
DEBUG := -DNDEBUG
endif
ifeq (prof,$(BUILD))
DEBUG := -DNDEBUG -D_PROFILING
STATIC = --static
endif
ifeq (pub,$(BUILD))
DEBUG := -DNDEBUG
BUILDTYPE = rel
STATIC = --static
STATICSYSLIBS := --static-system-libs
endif
# allow for an all-static build
ifndef STATIC
STATIC = $(shell test -f $(TOP)/build/STATIC && echo "--static")
endif
ifeq (--static,$(STATIC))
LINKAGE := -D_STATIC
LIBEXT = $(LIBX)
ILIBEXT = $(LIBX)
MODEXT = $(LIBX)
endif
# drop all suffix rules
.SUFFIXES:
# load OS and COMP specific files
include $(TOP)/build/Makefile.$(OS)
include $(TOP)/build/Makefile.$(COMP)
include $(TOP)/build/Makefile.rules
# full directory paths
TARGDIR = $(OUTDIR)/$(OSFLAV)/$(BUILD)/$(COMP)/$(ARCH)
BINDIR = $(TARGDIR)/bin
ILIBDIR = $(TARGDIR)/ilib
LIBDIR = $(TARGDIR)/lib
MODDIR = $(TARGDIR)/mod
WMODDIR = $(TARGDIR)/wmod
OBJDIR = $(TARGDIR)/obj/$(MODULE)
# path to the ncbi sub-directory
# this is where modules and installed schema files are kept
ifeq (win,$(OS))
# under Windows, we are always relative to binary path
NCBIDIR = $(BINDIR)/ncbi
else
ifeq (--static,$(STATIC))
# in static builds, we are relative to binary path
# because the configuration library will be part of tool
NCBIDIR = $(BINDIR)/ncbi
else
# in dynamic builds, we are relative to library path
# because the configuration library will live there
NCBIDIR = $(LIBDIR)/ncbi
endif
endif
# make reissue command
MAKE_CMD = $(MAKE) BUILD=$(BUILD) COMP=$(COMP) TOP=$(TOP) \
SRCDIR=$(SRCDIR) OUTDIR=$(OUTDIR) -C $(OBJDIR) -f $(SRCDIR)/Makefile
# directory and link creation
SUBDIRS = bin ilib lib mod wmod
OUTDIRS = schema
# clean rules
stdclean:
@ rm -rf $(OBJDIR)
@ rm -f $(addsuffix .vers.h,$(ALL_TOOLS) $(ALL_LIBS)) \
$(addsuffix .*,$(addprefix $(ILIBDIR)/,$(ALL_LIBS))) \
$(addsuffix .*,$(addprefix $(LIBDIR)/,$(ALL_LIBS))) \
$(addsuffix .*,$(addprefix $(MODDIR)/,$(ALL_LIBS))) \
$(addsuffix .*,$(addprefix $(WMODDIR)/,$(ALL_LIBS))) \
$(addsuffix *,$(addprefix $(BINDIR)/,$(ALL_TOOLS) $(ALL_LIBS)))
# removing symbolic links that point to specific builds
removelinks:
@ test ! -h $(OUTDIR)/schema && rm -rf $(OUTDIR)/schema || true
@ rm -f $(addprefix $(OUTDIR)/,$(addsuffix $(BITS),$(SUBDIRS)))
@ rm -f $(addprefix $(OUTDIR)/,$(OUTDIRS))
# create all required output directories
makedirs:
@ mkdir -p $(addprefix $(TARGDIR)/,$(SUBDIRS) obj/$(MODULE)) $(NCBIDIR)
ifeq (win,$(OS))
# Windows doesn't really support symbolic links
# we may add them back in when our toolkit is able to create them
rebuild-dirlinks: makedirs
@ true
else
LNDIRS = $(addprefix ln_,$(SUBDIRS))
$(LNDIRS):
@ ln -s $(TARGDIR)/$(subst ln_,,$@) $(OUTDIR)/$(subst ln_,,$@)$(BITS)
rebuild-dirlinks: removelinks makedirs $(LNDIRS)
@ ln -s $(TOP)/interfaces $(OUTDIR)/schema
endif
.PHONY: stdclean removelinks makedirs rebuild-dirlinks
# configuration targets
out:
echo $(OUTDIR) > $(TOP)/build/OUTDIR.$(OS)
@ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env rebuild-dirlinks
CC:
@ echo cc > $(TOP)/build/COMP.$(OS)
@ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env rebuild-dirlinks
GCC:
@ echo gcc > $(TOP)/build/COMP.$(OS)
@ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env rebuild-dirlinks
ICC:
@ echo icc > $(TOP)/build/COMP.$(OS)
@ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env rebuild-dirlinks
VC++:
@ echo vc++ > $(TOP)/build/COMP.$(OS)
@ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env rebuild-dirlinks
debug:
@ echo dbg > $(TOP)/build/BUILD.$(OS)
@ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env rebuild-dirlinks
profile:
@ echo prof > $(TOP)/build/BUILD.$(OS)
@ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env rebuild-dirlinks
release:
@ echo rel > $(TOP)/build/BUILD.$(OS)
@ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env rebuild-dirlinks
scm:
@ echo scm > $(TOP)/build/BUILD.$(OS)
@ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env rebuild-dirlinks
pubtools:
@ echo pub > $(TOP)/build/BUILD.$(OS)
@ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env rebuild-dirlinks
bindir:
@ echo "$(BINDIR)"
purify:
@ echo pur > $(TOP)/build/BUILD.$(OS)
@ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env rebuild-dirlinks
purecov:
@ echo pcov > $(TOP)/build/BUILD.$(OS)
@ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env rebuild-dirlinks
.PHONY: out CC GCC ICC debug profile release scm purify purecov
# includes based upon build
ITF = $(TOP)/interfaces
OSINC = $(TOP)/interfaces/os
CCINC = $(TOP)/interfaces/cc
XTINC = $(TOP)/interfaces/ext
# OS specific source and include dirs
SRCDIRS_OS = $(SRCDIR)/$(OS)
INCDIRS_OS = $(OSINC)/$(OS)
# most OS' have a parent type
ifdef OS_DAD
SRCDIRS_OS += $(SRCDIR)/$(OS_DAD)
INCDIRS_OS += $(OSINC)/$(OS_DAD)
# some OS' have a grandparent
ifdef OS_GDAD
SRCDIRS_OS += $(SRCDIR)/$(OS_GDAD)
INCDIRS_OS += $(OSINC)/$(OS_GDAD)
endif
endif
# compiler specific includes
INCDIRS_COMP = \
$(CCINC)/$(COMP)/$(ARCH) \
$(CCINC)/$(COMP)
# some compilers have a parent type
ifdef COMP_DAD
INCDIRS_COMP += \
$(CCINC)/$(COMP_DAD)/$(ARCH) \
$(CCINC)/$(COMP_DAD)
endif
VPATH = \
$(SRCDIR)/$(COMP)/$(ARCH) \
$(SRCDIR)/$(COMP) \
$(SRCDIRS_OS) \
$(SRCDIR)
INCDIRS = \
$(addprefix -I,$(SRCDIRS_OS)) \
$(addprefix -I,$(SRCDIR) $(ITF)) \
$(addprefix -I,$(INCDIRS_COMP)) \
$(addprefix -I,$(INCDIRS_OS) $(XTINC))
# defines that describe os & architecture
DLLX ?= $(SHLX)
ARCHDEFS = -D_ARCH_BITS=$(BITS) -DLIBPREFIX=$(LPFX) -DSHLIBEXT=$(DLLX)
# default tool parameters
CFLAGS = $(DEBUG) $(DBG) $(CARCH) $(PROF) $(PED) $(LINKAGE) $(DEFINES) $(ARCHDEFS) $(INCDIRS)
CPFLAGS = $(DEBUG) $(DBG) $(CARCH) $(PROF) $(LINKAGE) $(DEFINES) $(ARCHDEFS) $(INCDIRS)
LDFLAGS = $(DBG) $(PROF)
sra_sdk-2.1.7/build/Makefile.linux 0000664 0012213 0011620 00000004265 11477026530 016546 0 ustar rodarmer trace # ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# default compiler
ifeq (,$(COMP))
COMP = gcc
endif
# handle attempts to set cross-compilation architecture
# note that if your installation is set up for cross compilation,
# you can try to enable it on your own.
ifeq (i386,$(ARCH))
i386:
@ true
x86_64:
@ echo "Linux builds do not support cross-compilation to this architecture"
endif
ifeq (x86_64,$(ARCH))
i386:
@ echo "Linux builds do not support cross-compilation to this architecture"
x86_64:
@ true
endif
.PHONY: i386 x86_64
# library prefix
LPFX = lib
# file extensions
OBJX = o
LOBX = pic.o
LIBX = a
SHLX = so
# compilation defines
DEFINES := -DLINUX -DUNIX -D_GNU_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64
# linux is a Unix variant
OS_DAD = unix
# support for libxml
## TBD - move to libs/kxml, but this will break static builds...
ifdef NCBI
ifeq (dbg,$(BUILD))
LIBXML_LPATH = $(NCBI)/libxml/DebugMT/lib
else
LIBXML_LPATH = $(NCBI)/libxml/lib
endif
DFLT_LIBXML_INCLUDES = $(NCBI)/libxml/include/libxml2
endif
sra_sdk-2.1.7/build/BUILD.linux 0000644 0012213 0011620 00000000004 11625267705 015657 0 ustar rodarmer trace pub
sra_sdk-2.1.7/build/Makefile.rules 0000644 0012213 0011620 00000006427 11476752037 016550 0 ustar rodarmer trace # ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
## build rules
# executable image
%.$(OBJX): %.c
$(CC) -o $@ $(OPT) $<
%.$(OBJX): %.cpp
$(CP) -o $@ $(OPT) $<
%.$(OBJX): %.cxx
$(CP) -o $@ $(OPT) $<
# non-optimized executable image
%.nopt.$(OBJX): %.c
$(CC) -o $@ $(NOPT) $<
%.nopt.$(OBJX): %.cpp
$(CP) -o $@ $(NOPT) $<
%.nopt.$(OBJX): %.cxx
$(CP) -o $@ $(NOPT) $<
# relocatable image
%.$(LOBX): %.c
$(CC) -o $@ -fPIC $(OPT) -D_LIBRARY $<
%.$(LOBX): %.cpp
$(CP) -o $@ -fPIC $(OPT) -D_LIBRARY $<
%.$(LOBX): %.cxx
$(CP) -o $@ -fPIC $(OPT) -D_LIBRARY $<
# non-optimized relocatable image
%.nopt.$(LOBX): %.c
$(CC) -o $@ -fPIC $(NOPT) -D_LIBRARY $<
%.nopt.$(LOBX): %.cpp
$(CP) -o $@ -fPIC $(NOPT) -D_LIBRARY $<
%.nopt.$(LOBX): %.cxx
$(CP) -o $@ -fPIC $(NOPT) -D_LIBRARY $<
# non-optimized relocatable image with persisted image byte swapping
%.swap.nopt.$(LOBX): %.c
$(CC) -o $@ -fPIC -DSWAP_PERSISTED $(NOPT) -D_LIBRARY $<
%.swap.nopt.$(LOBX): %.cpp
$(CP) -o $@ -fPIC -DSWAP_PERSISTED $(NOPT) -D_LIBRARY $<
%.swap.nopt.$(LOBX): %.cxx
$(CP) -o $@ -fPIC -DSWAP_PERSISTED $(NOPT) -D_LIBRARY $<
# assembly
%.$(OBJX) %.$(LOBX): %.s
$(CC) -o $@ $<
# assembly language output
%.s: %.c
$(CC) -S -o $@ $(OPT) $<
%.s: %.cpp
$(CP) -S -o $@ $(OPT) $<
%.s: %.cxx
$(CP) -S -o $@ $(OPT) $<
%.nopt.s: %.c
$(CC) -S -o $@ $(NOPT) $<
%.nopt.s: %.cpp
$(CP) -S -o $@ $(NOPT) $<
%.nopt.s: %.cxx
$(CP) -S -o $@ $(NOPT) $<
%.pic.s: %.c
$(CC) -S -o $@ -fPIC $(OPT) $<
%.pic.s: %.cpp
$(CP) -S -o $@ -fPIC $(OPT) $<
%.pic.s: %.cxx
$(CP) -S -o $@ -fPIC $(OPT) $<
%.nopt.pic.s: %.c
$(CC) -S -o $@ -fPIC $(NOPT) $<
%.nopt.pic.s: %.cpp
$(CP) -S -o $@ -fPIC $(NOPT) $<
%.nopt.pic.s: %.cxx
$(CP) -S -o $@ -fPIC $(NOPT) $<
######################################################################
## TBD: *.vers.h will no longer be generated or used for executables #
# instead, we will update the linker to produce a *.vers.o #
# with a stub for KAppVersion to return a constant #
######################################################################
# version include generation
%.vers.h: %.vers
$(TOP)/build/make-vers-inc.sh $^ > $@
sra_sdk-2.1.7/build/Makefile.win 0000644 0012213 0011620 00000003355 11625747372 016212 0 ustar rodarmer trace # ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# default compiler
ifeq (,$(COMP))
COMP = vc++
endif
# handle attempts to set cross-compilation architecture
ifeq (i386,$(ARCH))
i386:
@ true
x86_64:
@ echo "Windows builds do not support cross-compilation to this architecture"
endif
ifeq (x86_64,$(ARCH))
i386:
@ echo "Windows builds do not support cross-compilation to this architecture"
x86_64:
@ true
endif
.PHONY: i386 x86_64
# library prefix
LPFX = lib
# file extensions
OBJX = obj
LOBX = pic.obj
LIBX = a
SHLX = lib
DLLX = dll
# compilation defines
DEFINES := -DWINDOWS
sra_sdk-2.1.7/build/abspath.sh 0000755 0012213 0011620 00000002420 11506455277 015725 0 ustar rodarmer trace #!/bin/sh
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
if cd "$1"
then
pwd
else
echo "`pwd`/$1"
fi
sra_sdk-2.1.7/build/ld.linux.cmn.sh 0000755 0012213 0011620 00000005766 11625212547 016625 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# script name
SELF_NAME="$(basename $0)"
# parameters
LD="$1"
ARCH="$2"
BUILD="$3"
shift 3
SRCDIR="$1"
BINDIR="$2"
OUTDIR="$3"
TARG="$4"
NAME="$5"
DBGAP="$6"
shift 6
VERS="$1"
VERSFILE="$2"
DEPFILE="$3"
shift 3
MODE="$1"
SCMFLAGS="$2"
LDFLAGS="$3"
shift 3
LDIRS="$1"
XDIRS="$2"
shift 2
OBJS="$1"
LIBS="$2"
# decode MODE
STATIC=$(expr $MODE % 2)
MODE=$(expr $MODE / 2)
DYLD=$(expr $MODE % 2)
MODE=$(expr $MODE / 2)
KPROC=$(expr $MODE % 2)
THREADS=$(expr $MODE / 2)
# decode SCMFLAGS
CHECKSUM=$(expr $SCMFLAGS % 2)
STATICSYSLIBS=$(expr $SCMFLAGS / 2)
# return parameter for find-lib
LIBPATH=''
# initial command state
CMD=''
LD_STATIC_STATE=0
LD_ALL_STATE=0
# for breaking out version
set-vers ()
{
MAJ=$1
MIN=$2
REL=$3
}
# for locating libraries
find-lib ()
{
_lib="lib$1"
_dirs="$2"
LIBPATH=''
while [ "$_dirs" != "" ]
do
_dir="${_dirs%%:*}"
if [ "$_dir" != "" ]
then
if [ -e "$_dir/$_lib" ]
then
while [ -L "$_dir/$_lib" ]
do
_lib=$(readlink -n "$_dir/$_lib")
done
LIBPATH="$_dir/$_lib"
break;
fi
fi
_dirs="${_dirs#$_dir}"
_dirs="${_dirs#:}"
done
}
# setting state
load-static ()
{
if [ $LD_STATIC_STATE -eq 0 ]
then
CMD="$CMD $LD_STATIC"
LD_STATIC_STATE=1
fi
}
load-dynamic ()
{
if [ $LD_STATIC_STATE -eq 1 ]
then
CMD="$CMD $LD_DYNAMIC"
LD_STATIC_STATE=0
fi
}
load-all-symbols ()
{
if [ $LD_ALL_STATE -eq 0 ]
then
CMD="$CMD $LD_ALL_SYMBOLS"
LD_ALL_STATE=1
fi
}
load-ref-symbols ()
{
if [ $LD_ALL_STATE -eq 1 ]
then
CMD="$CMD $LD_REF_SYMBOLS"
LD_ALL_STATE=0
fi
}
sra_sdk-2.1.7/build/ld.linux.dlib.sh 0000755 0012213 0011620 00000016220 11625212547 016745 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# ===========================================================================
# input library types, and their handling
#
# normal linkage
# -l : find shared or static
# -s : require static
# -d : require shared
#
# static linkage
# -l : require static
# -s : require static
# -d : ignore
# ===========================================================================
# script name
SELF_NAME="$(basename $0)"
BUILD_DIR="$(dirname $0)"
# parameters and common functions
source "${0%dlib.sh}cmn.sh"
# discover tool chain
case "$LD" in
g*)
source "${0%dlib.sh}gcc.sh"
;;
i*)
source "${0%dlib.sh}icc.sh"
;;
*)
echo "$SELF_NAME: unrecognized ld tool - '$LD'"
exit 5
esac
# DLIB_CMD was started in tool-specific source
CMD="$DLIB_CMD $LDFLAGS"
# tack on object files
CMD="$CMD $OBJS"
# list of static libraries used to create dynamic lib
SLIBS=''
# initial dependency upon Makefile and vers file
DEPS="$SRCDIR/Makefile $VERSFILE"
if [ "$LIBS" != "" ]
then
# tack on paths
DIRS="$LDIRS:$XDIRS"
while [ "$DIRS" != "" ]
do
DIR="${DIRS%%:*}"
[ "$DIR" != "" ] && CMD="$CMD -L$DIR"
DIRS="${DIRS#$DIR}"
DIRS="${DIRS#:}"
done
# tack on libraries, finding as we go
for LIB in $LIBS
do
# strip off switch
LIBNAME="${LIB#-[lsd]}"
# look at linkage
case "$LIB" in
-ldl|-ddl)
# always load libdl as shared library
load-ref-symbols
load-dynamic
CMD="$CMD -ldl"
;;
-l*)
# normal or dynamic linkage
FOUND=0
if [ $STATIC -eq 0 ]
then
find-lib $LIBNAME.so $LDIRS
if [ "$LIBPATH" != "" ]
then
# found it
FOUND=1
# load normally
load-ref-symbols
load-dynamic
CMD="$CMD -l$LIBNAME"
fi
fi
# try static only
if [ $FOUND -eq 0 ]
then
find-lib $LIBNAME.a $LDIRS
if [ "$LIBPATH" != "" ]
then
# found it
FOUND=1
# add it to dependencies
DEPS="$DEPS $LIBPATH"
SLIBS="$SLIBS $(dirname $LIBPATH)/lib$LIBNAME.a"
# load static
load-static
load-all-symbols
CMD="$CMD -l$LIBNAME"
fi
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
if [ $STATICSYSLIBS -eq 1 ]
then
case "$LIBNAME" in
z|bz2)
# set load to static
load-static
load-all-symbols
;;
*)
# set load to dynamic
load-ref-symbols
load-dynamic
;;
esac
else
# set load to normal
load-ref-symbols
load-dynamic
fi
CMD="$CMD -l$LIBNAME"
fi
;;
-s*)
# force static load
FOUND=0
find-lib $LIBNAME.a $LDIRS
if [ "$LIBPATH" != "" ]
then
# found it
FOUND=1
# add it to dependencies
DEPS="$DEPS $LIBPATH"
SLIBS="$SLIBS $(dirname $LIBPATH)/lib$LIBNAME.a"
# load static
load-static
load-all-symbols
CMD="$CMD -l$LIBNAME"
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
if [ $STATIC -eq 1 ] || [ $STATICSYSLIBS -eq 1 ]
then
# set load to static
load-static
load-all-symbols
else
case "$LIBNAME" in
z|bz2)
# set load to dynamic
load-ref-symbols
load-dynamic
;;
*)
# set load to static
load-static
load-all-symbols
;;
esac
fi
CMD="$CMD -l$LIBNAME"
fi
;;
-d*)
# only dynamic linkage
FOUND=0
if [ $STATIC -eq 0 ]
then
find-lib $LIBNAME.so $LDIRS
if [ "$LIBPATH" != "" ]
then
# found it
FOUND=1
# load normally
load-ref-symbols
load-dynamic
CMD="$CMD -l$LIBNAME"
fi
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
# set load to normal
load-ref-symbols
load-dynamic
CMD="$CMD -l$LIBNAME"
fi
;;
esac
done
fi
# put state back to normal
load-ref-symbols
load-dynamic
# add in pthreads
if [ $THREADS -ne 0 ]
then
CMD="$CMD -lpthread"
fi
# produce shared library
echo "$CMD"
$CMD || exit $?
# produce dependencies
if [ "$DEPFILE" != "" ]
then
echo "$TARG: $DEPS" > "$DEPFILE"
fi
if [ $CHECKSUM -eq 1 ]
then
SCM_DIR="${BUILD_DIR%/*}/scm"
LOGFILE="$SCM_DIR/scm.log"
MSG=">>>>> scm: calling the collect script from ld.linux.dlib.sh <<<<<<"
#echo "$MSG"
echo "$MSG" >> $LOGFILE
"$BUILD_DIR/scm-collect.sh" "$OBJS" "$SLIBS" | sort -u > "$TARG.md5"
fi sra_sdk-2.1.7/build/increment-release.sh 0000755 0012213 0011620 00000002757 11506455277 017722 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# capture input
VERSION=$1
# split the version into separate integers
SPLIT_VERS="$(echo $VERSION | tr '.' ' ')"
inc-version ()
{
local MAJ=$1
local MIN=$2
local REL=$(expr $3 + 1)
echo "$MAJ.$MIN.$REL"
}
# rewrite the version
inc-version $SPLIT_VERS
sra_sdk-2.1.7/build/ld.linux.gcc.sh 0000755 0012213 0011620 00000003431 11506455277 016576 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# define linker params
LD_EXPORT_GLOBAL="-Wl,--export-dynamic"
LD_MULTIPLE_DEFS="-Wl,-zmuldefs"
LD_STATIC="-Wl,-Bstatic"
LD_DYNAMIC="-Wl,-Bdynamic"
LD_ALL_SYMBOLS="-Wl,-whole-archive"
LD_REF_SYMBOLS="-Wl,-no-whole-archive"
# build command
DLIB_CMD="$LD -shared"
EXE_CMD="$LD"
# versioned output
if [ "$VERS" = "" ]
then
DLIB_CMD="$DLIB_CMD -o $TARG"
EXE_CMD="$EXE_CMD -o $TARG"
else
set-vers $(echo $VERS | tr '.' ' ')
DLIB_CMD="$DLIB_CMD -o $OUTDIR/$NAME$DBGAP.so.$VERS -Wl,-soname,$NAME.so.$MAJ"
EXE_CMD="$EXE_CMD -o $OUTDIR/$NAME$DBGAP.$VERS"
fi
sra_sdk-2.1.7/build/ld.linux.icc.sh 0000755 0012213 0011620 00000003421 11506455277 016577 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# define linker params
LD_EXPORT_GLOBAL="-Wa,--export-dynamic"
LD_MULTIPLE_DEFS="-Wa,-zmuldefs"
LD_STATIC="-Bstatic"
LD_DYNAMIC="-Bdynamic"
LD_ALL_SYMBOLS="-Wa,-whole-archive"
LD_REF_SYMBOLS="-Wa,-no-whole-archive"
# build command
DLIB_CMD="$LD -shared"
EXE_CMD="$LD"
# versioned output
if [ "$VERS" = "" ]
then
DLIB_CMD="$DLIB_CMD -o $TARG"
EXE_CMD="$EXE_CMD -o $TARG"
else
set-vers $(echo $VERS | tr '.' ' ')
DLIB_CMD="$DLIB_CMD -o $OUTDIR/$NAME$DBGAP.so.$VERS -Wl,-soname,$NAME.so.$MAJ"
EXE_CMD="$EXE_CMD -o $OUTDIR/$NAME$DBGAP.$VERS"
fi
sra_sdk-2.1.7/build/ld.mac.gcc.sh 0000755 0012213 0011620 00000003742 11576721671 016205 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# define linker params
LD_EXPORT_GLOBAL="-Wl,-all_load"
LD_MULTIPLE_DEFS=""
LD_STATIC=""
LD_DYNAMIC=""
LD_ALL_SYMBOLS=""
LD_REF_SYMBOLS=""
# the Mac is set up for cross-compilation
LD="$LD -Wl,-arch,$ARCH"
# build command
DLIB_CMD="$LD -dynamiclib"
EXE_CMD="$LD"
# Mach install-name sans extension
INSTNAME="@executable_path/../lib/$NAME$DBGAP"
# versioned output
if [ "$VERS" = "" ]
then
DLIB_CMD="$DLIB_CMD -o $TARG -install_name $INSTNAME.dylib"
EXE_CMD="$EXE_CMD -o $TARG"
else
set-vers $(echo $VERS | tr '.' ' ')
DLIB_CMD="$DLIB_CMD -o $OUTDIR/$NAME$DBGAP.$VERS.dylib -install_name $INSTNAME.$VERS.dylib -compatibility_version $MAJ -current_version $VERS -flat_namespace -undefined suppress"
EXE_CMD="$EXE_CMD -o $OUTDIR/$NAME$DBGAP.$VERS"
fi
sra_sdk-2.1.7/build/make-vers-inc.sh 0000755 0012213 0011620 00000003174 11506455277 016753 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# capture input
if [ $# -eq 1 ]
then
VERSION=$1
DEFINE=$(basename $VERSION)
DEFINE=$(echo $DEFINE | tr '[a-z].-' '[A-Z]__')
elif [ $# -ne 2 ]
then
echo "#error in makefile"
exit 1
else
DEFINE=$1
VERSION=$2
fi
# split the version into separate integers
SPLIT_VERS="$(cat $VERSION | tr '.' ' ')"
# issue a single line define
echo "#define $DEFINE $(printf 0x%02X%02X%04X $SPLIT_VERS)"
sra_sdk-2.1.7/build/STATIC 0000664 0012213 0011620 00000000000 11543170350 014633 0 ustar rodarmer trace sra_sdk-2.1.7/build/cc.sh 0000755 0012213 0011620 00000005700 11550612416 014661 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# prepare script name
SELF_NAME="$(basename $0)"
SCRIPT_BASE="${0%.sh}"
# os
OS="$1"
shift
# binary compiler
CC="$1"
shift
# configuration
unset TARG
unset ARGS
CHECKSUM=0
OBJX=o
while [ $# -ne 0 ]
do
case "$1" in
--cflags)
ARGS="$ARGS $2"
shift
;;
--checksum)
CHECKSUM=1
;;
--objx)
OBJX="$2"
shift
;;
-o*)
ARGS="$ARGS $1"
ARG="${1#-o}"
if [ "$ARG" = "" ]
then
ARGS="$ARGS $2"
ARG="$2"
shift
fi
TARG="$ARG"
;;
*)
ARGS="$ARGS $1"
;;
esac
shift
done
# *** START SCM-code ***************************************
if [ $CHECKSUM -eq 1 ]
then
if [ "$TARG" = "" ]
then
echo "$SELF_NAME: no target specified"
exit 5
fi
if [ "$TARG" = "${TARG%.$OBJX}" ]
then
echo "$SELF_NAME: malformed target"
exit 6
fi
TARG="${TARG%.$OBJX}"
fi
# *** END SCM-code ***************************************
CMD="$CC $ARGS"
echo "$CMD"
$CMD || exit $?
# *** START SCM-code ***************************************
if [ $CHECKSUM -eq 1 ] && [ "$OS" = "linux" ]
then
CMD="strip $TARG.$OBJX -o $TARG.stripped.$OBJX"
echo "$CMD"
if $CMD
then
MD5RES=`md5sum -b $TARG.stripped.$OBJX`
STATUS=$?
rm -f "$TARG.stripped.$OBJX" || true
if [ $STATUS -eq 0 ]
then
MD5VALUE=${MD5RES:0:32}
echo "$TARG.$OBJX=$MD5VALUE" > "$TARG.$OBJX.md5"
else
exit $STATUS
fi
else
STATUS=$?
rm "$TARG.$OBJX"
exit $STATUS
fi
fi
# *** END SCM-code ***************************************
sra_sdk-2.1.7/build/BUILD.mac 0000644 0012213 0011620 00000000004 11625267705 015260 0 ustar rodarmer trace pub
sra_sdk-2.1.7/build/Makefile.vc++ 0000644 0012213 0011620 00000005036 11630010446 016126 0 ustar rodarmer trace # ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# compilers
CC = @ $(TOP)/build/win-cc.sh win "cl /c -D_WIN32_WINNT=0x0502" \
$(CHECKSUM) --objx $(OBJX) $(CFLAGS) -MD
CP = @ $(TOP)/build/win-cc.sh win "cl /c" \
$(CHECKSUM) --objx $(OBJX) $(CPFLAGS) -MD
# C preprocessor
PP = gcc -E $(CFLAGS)
# linkers
LD = @ $(TOP)/build/ld.sh win $(ARCH) link \
--build $(BUILD) $(LDFLAGS) $(STATIC) $(CHECKSUM) \
--objx $(OBJX) --shlx $(SHLX) --libx $(LIBX) \
-MD --srcdir $(SRCDIR) --bindir $(BINDIR) -L$(LIBDIR):$(ILIBDIR)
LP = @ $(TOP)/build/ld.sh win $(ARCH) link \
--build $(BUILD) $(LDFLAGS) $(STATIC) $(CHECKSUM) \
--objx $(OBJX) --shlx $(SHLX) --libx $(LIBX) \
-MD --srcdir $(SRCDIR) --bindir $(BINDIR) -L$(LIBDIR):$(ILIBDIR)
# tool options
CDECL = -Gd
STDCALL = -Gz
CALLCONV = $(STDCALL)
STRING_POOLING = -GF
OPT := $(STRING_POOLING) $(CALLCONV) -nologo
NOPT := -Od $(OPT)
ifeq (64,$(BITS))
CARCH = #-m64
else
CARCH = #-m32
WARN := #-Wall
endif
ifeq (prof, $(BUILD))
# PROF := -pg
endif
ifeq (dbg, $(BUILD))
DBG = -Od
OPT += -Zi $(WARN)
NOPT += -Zi $(WARN)
else
# -Ox caused us failures noticed in libs/vdb/cast.c
# OPT += -Ox -w
# /Ox == /Ob2gity g is deprecated so removed
# Removing either the 2 or the t makes it seem to work
# But there is a warning about not knowing what /Ob is
# if the 2 is removed. But not if the 2 is there.
# Woo hoo Microsoft...
OPT += -Ob2iy -w
endif
sra_sdk-2.1.7/build/Makefile.shell 0000664 0012213 0011620 00000005056 11550613203 016504 0 ustar rodarmer trace # ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# determine OS
UNAME = $(shell uname -s)
ifeq (Darwin, $(UNAME))
OS = mac
endif
ifeq (Linux, $(UNAME))
OS = linux
endif
ifeq (SunOS, $(UNAME))
OS = sun
endif
ifeq (xCYGWIN, $(findstring xCYGWIN,x$(UNAME)))
OS = win
endif
ifeq (xMINGW, $(findstring xMINGW,x$(UNAME)))
OS = win
endif
# OS flavor is normally OS
OSFLAV = $(OS)
# determine ARCH
ifeq (mac,$(OS))
ARCH = $(shell $(TOP)/build/mac.arch.sh)
else
MARCH = $(shell uname -m)
ifeq (i386, $(MARCH))
ARCH = i386
endif
ifeq (i486, $(MARCH))
ARCH = i386
endif
ifeq (i586, $(MARCH))
ARCH = i386
endif
ifeq (i686, $(MARCH))
ARCH = i386
endif
ifeq (x86_64, $(MARCH))
ARCH = x86_64
endif
ifeq (sun4u,$(MARCH))
ARCH = sparc32
endif
endif
# determine BITS
ifeq (x86_64, $(ARCH))
BITS = 64
else
BITS = 32
endif
# first pass through defines SRCDIR
ifndef SRCDIR
# set SRCDIR from MODULE
ifdef MODULE
SRCDIR=$(TOP)/$(MODULE)
else
SRCDIR=$(TOP)
endif
# set OUTDIR
ifndef OUTDIR
OUTDIR = $(shell test -f $(TOP)/build/OUTDIR.$(OS) && cat $(TOP)/build/OUTDIR.$(OS) || echo $(TOP))
ifeq (,$(OUTDIR))
OUTDIR = $(TOP)
endif
ifeq (.,$(OUTDIR))
OUTDIR = $(TOP)
endif
endif
# set COMP and BUILD
COMP = $(shell test -f $(TOP)/build/COMP.$(OS) && cat $(TOP)/build/COMP.$(OS) || echo gcc)
BUILD = $(shell test -f $(TOP)/build/BUILD.$(OS) && cat $(TOP)/build/BUILD.$(OS) || echo dbg)
endif
sra_sdk-2.1.7/build/COMP.linux 0000644 0012213 0011620 00000000004 11542740620 015544 0 ustar rodarmer trace gcc
sra_sdk-2.1.7/build/Makefile.gcc 0000644 0012213 0011620 00000004426 11577656545 016160 0 ustar rodarmer trace # ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# compilers
CC = @ $(TOP)/build/cc.sh $(OS) 'gcc -c' \
$(CHECKSUM) --objx $(OBJX) --cflags "$(CFLAGS)" -MD
CP = @ $(TOP)/build/cc.sh $(OS) 'g++ -c' \
$(CHECKSUM) --objx $(OBJX) --cflags "$(CPFLAGS)" -MD
# C preprocessor
PP = gcc -E $(CFLAGS)
# linkers
LD = @ $(TOP)/build/ld.sh $(OS) $(ARCH) gcc \
--build $(BUILD) --ldflags "$(LDFLAGS)" $(STATIC) \
$(STATICSYSLIBS) $(CHECKSUM) --objx $(OBJX) --shlx $(SHLX) --libx $(LIBX) \
-MD --srcdir $(SRCDIR) --bindir $(BINDIR) -L$(LIBDIR):$(ILIBDIR)
LP = @ $(TOP)/build/ld.sh $(OS) $(ARCH) g++ \
--build $(BUILD) --ldflags "$(LDFLAGS)" $(STATIC) \
$(STATICSYSLIBS) $(CHECKSUM) --objx $(OBJX) --shlx $(SHLX) --libx $(LIBX) \
-MD --srcdir $(SRCDIR) --bindir $(BINDIR) -L$(LIBDIR):$(ILIBDIR)
# tool options
WARN = -Wall # -Wconversion
ifeq (64,$(BITS))
CARCH = -m64
else
CARCH = -m32
endif
ifeq (prof, $(BUILD))
PROF = -pg
endif
ifeq (dbg, $(BUILD))
DBG = -g
OPT = $(WARN)
NOPT = $(WARN)
PED = -std=c99 -ansi -pedantic
else
ifeq (x86_64, $(ARCH))
OPT = -O3 -fno-strict-aliasing
else
OPT = -O3 -fno-strict-aliasing
endif
endif
sra_sdk-2.1.7/build/Makefile.icc 0000644 0012213 0011620 00000004502 11556621613 016136 0 ustar rodarmer trace # ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# compilers
CC = @ $(TOP)/build/cc.sh $(OS) 'icc -c' \
$(CHECKSUM) --objx $(OBJX) --cflags "$(CFLAGS)" -MD
CP = @ $(TOP)/build/cc.sh $(OS) 'icpc -c' \
$(CHECKSUM) --objx $(OBJX) --cflags "$(CPFLAGS)" -MD
# C preprocessor
PP = icc -E $(CFLAGS)
# linkers
LD = @ $(TOP)/build/ld.sh $(OS) $(ARCH) icc \
--build $(BUILD) --ldflags "$(LDFLAGS)" $(STATIC) \
$(STATICSYSLIBS) $(CHECKSUM) --objx $(OBJX) --shlx $(SHLX) --libx $(LIBX) \
-MD --srcdir $(SRCDIR) --bindir $(BINDIR) -L$(LIBDIR):$(ILIBDIR)
LP = @ $(TOP)/build/ld.sh $(OS) $(ARCH) icpc \
--build $(BUILD) --ldflags "$(LDFLAGS)" $(STATIC) \
$(STATICSYSLIBS) $(CHECKSUM) --objx $(OBJX) --shlx $(SHLX) --libx $(LIBX) \
-MD --srcdir $(SRCDIR) --bindir $(BINDIR) -L$(LIBDIR):$(ILIBDIR)
# tool options
WARN = -Wall
ifeq (64,$(BITS))
CARCH = -m64
else
CARCH = -m32
endif
ifeq (prof, $(BUILD))
PROF := -p
endif
ifeq (dbg, $(BUILD))
DBG = -g
OPT = $(WARN)
NOPT = $(WARN)
else
ifeq (x86_64, $(ARCH))
OPT := -O3 -unroll -xW
else
OPT := -O3 -unroll -xW
endif
endif
ifeq (prof, $(BUILD))
OPT += -vec_report5
endif
# ICC is designed to be a GCC substitute
COMP_DAD = gcc
sra_sdk-2.1.7/build/ld.linux.exe.sh 0000775 0012213 0011620 00000017074 11625212547 016626 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# ===========================================================================
# input library types, and their handling
#
# normal linkage
# -l : find shared or static
# -s : require static
# -d : ignore - will be dynamically loaded
#
# static linkage
# -l : require static
# -s : require static
# -d : require static
# ===========================================================================
# script name
SELF_NAME="$(basename $0)"
BUILD_DIR="$(dirname $0)"
# parameters and common functions
source "${0%exe.sh}cmn.sh"
# discover tool chain
case "$LD" in
g*)
source "${0%exe.sh}gcc.sh"
;;
i*)
source "${0%exe.sh}icc.sh"
;;
*)
echo "$SELF_NAME: unrecognized ld tool - '$LD'"
exit 5
esac
# EXE_CMD was started in tool-specific source
CMD="$EXE_CMD $LDFLAGS"
# if building a static executable against dynamic libraries
# the main application will substitute for name lookup
if [ $STATIC -eq 1 ] && [ $DYLD -eq 1 ]
then
CMD="$CMD $LD_EXPORT_GLOBAL $LD_MULTIPLE_DEFS"
fi
# tack on object files
CMD="$CMD $OBJS"
# list of static libraries used to create executable
SLIBS=''
# initial dependency upon Makefile and vers file
DEPS="$SRCDIR/Makefile $VERSFILE"
if [ "$LIBS" != "" ]
then
# tack on paths
DIRS="$LDIRS:$XDIRS"
while [ "$DIRS" != "" ]
do
DIR="${DIRS%%:*}"
[ "$DIR" != "" ] && CMD="$CMD -L$DIR"
DIRS="${DIRS#$DIR}"
DIRS="${DIRS#:}"
done
# tack on libraries, finding as we go
for LIB in $LIBS
do
# strip off switch
LIBNAME="${LIB#-[lsd]}"
# look at linkage
case "$LIB" in
-ldl|-ddl)
# always load libdl as shared library
load-ref-symbols
load-dynamic
CMD="$CMD -ldl"
;;
-l*)
# normal or dynamic linkage
FOUND=0
if [ $STATIC -eq 0 ]
then
find-lib $LIBNAME.so $LDIRS
if [ "$LIBPATH" != "" ]
then
# found it
FOUND=1
# load dynamic
load-dynamic
CMD="$CMD -l$LIBNAME"
fi
fi
# try static only
if [ $FOUND -eq 0 ]
then
find-lib $LIBNAME.a $LDIRS
if [ "$LIBPATH" != "" ]
then
# found it
FOUND=1
# add it to dependencies
DEPS="$DEPS $LIBPATH"
SLIBS="$SLIBS $(dirname $LIBPATH)/lib$LIBNAME.a"
# load static
load-static
[ $STATIC -eq 1 ] && load-all-symbols
CMD="$CMD -l$LIBNAME"
fi
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
# do not need to load all symbols for external libs
[ $STATIC -eq 1 ] && load-ref-symbols
if [ $STATICSYSLIBS -eq 1 ]
then
case "$LIBNAME" in
z|bz2)
# set load to static
load-static
;;
*)
# set load to dynamic
load-dynamic
;;
esac
else
# set load to normal
load-dynamic
fi
CMD="$CMD -l$LIBNAME"
fi
;;
-s*)
# force static load
FOUND=0
find-lib $LIBNAME.a $LDIRS
if [ "$LIBPATH" != "" ]
then
# found it
FOUND=1
# add it to dependencies
DEPS="$DEPS $LIBPATH"
SLIBS="$SLIBS $(dirname $LIBPATH)/lib$LIBNAME.a"
# load static
load-static
[ $STATIC -eq 1 ] && load-all-symbols
CMD="$CMD -l$LIBNAME"
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
# do not need to load all symbols for external libs
[ $STATIC -eq 1 ] && load-ref-symbols
if [ $STATIC -eq 1 ] || [ $STATICSYSLIBS -eq 1 ]
then
# set load to static
load-static
else
# special case for libs we have in "ext"
# that are sometimes requested as static
case "$LIBNAME" in
z|bz2)
# set load to dynamic
load-dynamic
;;
*)
load-static
;;
esac
fi
CMD="$CMD -l$LIBNAME"
fi
;;
-d*)
FOUND=0
if [ $STATIC -eq 1 ]
then
find-lib $LIBNAME.a $LDIRS
if [ "$LIBPATH" != "" ]
then
# found it
FOUND=1
# add it to dependencies
DEPS="$DEPS $LIBPATH"
SLIBS="$SLIBS $(dirname $LIBPATH)/lib$LIBNAME.a"
# load static
load-static
load-all-symbols
CMD="$CMD -l$LIBNAME"
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
load-static
load-all-symbols
CMD="$CMD -l$LIBNAME"
fi
fi
;;
esac
done
fi
# return to normal
load-ref-symbols
load-dynamic
# add in pthreads
if [ $THREADS -ne 0 ]
then
CMD="$CMD -lpthread"
fi
# produce shared library
echo $CMD
$CMD || exit $?
# produce dependencies
if [ "$DEPFILE" != "" ]
then
echo "$TARG: $DEPS" > "$DEPFILE"
fi
if [ $CHECKSUM -eq 1 ]
then
SCM_DIR="${BUILD_DIR%/*}/scm"
LOGFILE="$SCM_DIR/scm.log"
MSG=">>>>> scm: calling the collect script from ld.linux.exe.sh <<<<<<"
#echo "$MSG"
echo "$MSG" >> $LOGFILE
"$BUILD_DIR/scm-collect.sh" "$OBJS" "$SLIBS" | sort -u > "$TARG.md5"
fi
sra_sdk-2.1.7/build/ld.linux.ln.sh 0000755 0012213 0011620 00000004375 11506455277 016463 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# script name
SELF_NAME="$(basename $0)"
# parameters
TYPE="$1"
OUTDIR="$2"
TARG="$3"
NAME="$4"
DBGAP="$5"
EXT="$6"
VERS="$7"
# find target
TARG=$(basename "$TARG")
# put extension back onto name
NAME="$NAME$DBGAP"
[ "$EXT" != "" ] && NAME="$NAME.$EXT"
# break out version
set-vers ()
{
MAJ=$1
MIN=$2
REL=$3
}
set-vers $(echo $VERS | tr '.' ' ')
cd "$OUTDIR" || exit 5
# create link
create-link ()
{
rm -f "$2"
local CMD="ln -s $1 $2"
echo $CMD
$CMD
}
# test for version in target name
if [ "$TARG" != "$NAME.$MAJ.$MIN.$REL" ]
then
# for simple name, create 2 links
if [ "$TARG" = "$NAME" ]
then
create-link "$NAME.$MAJ.$MIN.$REL" "$NAME.$MAJ"
create-link "$NAME.$MAJ" "$NAME"
# for name with major version in it
elif [ "$TARG" = "$NAME.$MAJ" ]
then
create-link "$NAME.$MAJ.$MIN.$REL" "$NAME.$MAJ"
# for name with major & minor version in it
elif [ "$TARG" = "$NAME.$MAJ.$MIN" ]
then
create-link "$NAME.$MAJ.$MIN.$REL" "$NAME.$MAJ.$MIN"
fi
fi
sra_sdk-2.1.7/build/ld.linux.slib.sh 0000755 0012213 0011620 00000007255 11550612416 016770 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# ===========================================================================
# input library types, and their handling
#
# normal or static linkage
# -l : require static
# -s : require static
# -d : ignore
# ===========================================================================
# script name
SELF_NAME="$(basename $0)"
BUILD_DIR="$(dirname $0)"
# parameters and common functions
source "${0%slib.sh}cmn.sh"
# initialize command
CMD="ar -rc"
# function to convert an archive into individual object files
convert-static ()
{
# list members
local path="$1"
local mbrs="$(ar -t $path)"
# unpack archive into temporary directory
mkdir -p ld-tmp
if ! cd ld-tmp
then
echo "$SELF_NAME: failed to cd to ld-tmp"
exit 5
fi
ar -x "$path"
# rename and add to source files list
local m=
for m in $mbrs
do
mv $m $NAME-$m
CMD="$CMD ld-tmp/$NAME-$m"
done
# return to prior location
cd - > /dev/null
}
# versioned output
if [ "$VERS" = "" ]
then
CMD="$CMD $TARG"
else
set-vers $(echo $VERS | tr '.' ' ')
CMD="$CMD $OUTDIR/$NAME$DBGAP.a.$VERS"
fi
# tack on object files
CMD="$CMD $OBJS"
# list of static libraries used to create this lib
SLIBS=''
# initial dependency upon Makefile and vers file
DEPS="$SRCDIR/Makefile $VERSFILE"
if [ "$LIBS" != "" ]
then
# tack on libraries, finding as we go
for LIB in $LIBS
do
# strip off switch
LIBNAME="${LIB#-[lsd]}"
# look at linkage
case "$LIB" in
-l*|-s*)
# force static load
LIBPATH="$(find-lib $LIBNAME.a $LDIRS)"
if [ "$LIBPATH" != "" ]
then
# add it to dependencies
DEPS="$DEPS $LIBPATH"
SLIBS="$SLIBS $(dirname $LIBPATH)/lib$LIBNAME.a"
# convert to individual object files
convert-static "$LIBPATH" || exit $?
fi
;;
esac
done
fi
# produce static library
echo $CMD
$CMD || exit $?
# remove temporaries
rm -rf ld-tmp
# produce dependencies
if [ "$DEPFILE" != "" ] && [ "$DEPS" != "" ]
then
echo "$TARG: $DEPS" > "$DEPFILE"
fi
if [ $CHECKSUM -eq 1 ]
then
SCM_DIR="${BUILD_DIR%/*}/scm"
LOGFILE="$SCM_DIR/scm.log"
MSG=">>>>> scm: calling the collect script from ld.linux.slib.sh <<<<<<"
#echo "$MSG"
echo "$MSG" >> $LOGFILE
"$BUILD_DIR/scm-collect.sh" "$OBJS" "$SLIBS" | sort -u > "$TARG.md5"
fi
sra_sdk-2.1.7/build/ld.mac.cmn.sh 0000755 0012213 0011620 00000005717 11625212547 016222 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# script name
SELF_NAME="$(basename $0)"
# parameters
LD="$1"
ARCH="$2"
BUILD="$3"
shift 3
SRCDIR="$1"
BINDIR="$2"
OUTDIR="$3"
TARG="$4"
NAME="$5"
DBGAP="$6"
shift 6
VERS="$1"
VERSFILE="$2"
DEPFILE="$3"
shift 3
MODE="$1"
CHECKSUM="$2"
LDFLAGS="$3"
shift 3
LDIRS="$1"
XDIRS="$2"
shift 2
OBJS="$1"
LIBS="$2"
# decode MODE
STATIC=$(expr $MODE % 2)
MODE=$(expr $MODE / 2)
DYLD=$(expr $MODE % 2)
MODE=$(expr $MODE / 2)
KPROC=$(expr $MODE % 2)
THREADS=$(expr $MODE / 2)
# return parameter for find-lib
LIBPATH=''
# initial command state
CMD=''
LD_STATIC_STATE=0
LD_ALL_STATE=0
# for breaking out version
set-vers ()
{
MAJ=$1
MIN=$2
REL=$3
}
# for locating libraries
find-lib ()
{
_lib="lib$1"
_dirs="$2"
LIBPATH=''
while [ "$_dirs" != "" ]
do
_dir="${_dirs%%:*}"
if [ "$_dir" != "" ]
then
if [ -e "$_dir/$_lib" ]
then
while [ -L "$_dir/$_lib" ]
do
_lib=$(readlink -n "$_dir/$_lib")
done
LIBPATH="$_dir/$_lib"
break;
fi
fi
_dirs="${_dirs#$_dir}"
_dirs="${_dirs#:}"
done
}
# setting state
load-static ()
{
if [ $LD_STATIC_STATE -eq 0 ]
then
CMD="$CMD $LD_STATIC"
LD_STATIC_STATE=1
fi
}
load-dynamic ()
{
if [ $LD_STATIC_STATE -eq 1 ]
then
CMD="$CMD $LD_DYNAMIC"
LD_STATIC_STATE=0
fi
}
load-all-symbols ()
{
if [ $LD_ALL_STATE -eq 0 ]
then
CMD="$CMD $LD_ALL_SYMBOLS"
# the Mac linker doesn't support state
LD_ALL_STATE=0
fi
}
load-ref-symbols ()
{
if [ $LD_ALL_STATE -eq 1 ]
then
CMD="$CMD $LD_REF_SYMBOLS"
LD_ALL_STATE=0
fi
}
sra_sdk-2.1.7/build/ld.mac.dlib.sh 0000755 0012213 0011620 00000012524 11506455277 016360 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# ===========================================================================
# input library types, and their handling
#
# normal linkage
# -l : find shared or static
# -s : require static
# -d : require shared
#
# static linkage
# -l : require static
# -s : require static
# -d : ignore
# ===========================================================================
# script name
SELF_NAME="$(basename $0)"
# parameters and common functions
source "${0%dlib.sh}cmn.sh"
# discover tool chain
case "$LD" in
g*)
source "${0%dlib.sh}gcc.sh"
;;
i*)
source "${0%dlib.sh}icc.sh"
;;
*)
echo "$SELF_NAME: unrecognized ld tool - '$LD'"
exit 5
esac
# DLIB_CMD was started in tool-specific source
CMD="$DLIB_CMD $LDFLAGS"
# tack on object files
CMD="$CMD $OBJS"
# initial dependency upon Makefile and vers file
DEPS="$SRCDIR/Makefile $VERSFILE"
if [ "$LIBS" != "" ]
then
# tack on paths
DIRS="$LDIRS:$XDIRS"
while [ "$DIRS" != "" ]
do
DIR="${DIRS%%:*}"
[ "$DIR" != "" ] && CMD="$CMD -L$DIR"
DIRS="${DIRS#$DIR}"
DIRS="${DIRS#:}"
done
# tack on libraries, finding as we go
for LIB in $LIBS
do
# strip off switch
LIBNAME="${LIB#-[lsd]}"
# look at linkage
case "$LIB" in
-l*)
# normal or dynamic linkage
FOUND=0
if [ $STATIC -eq 0 ]
then
find-lib $LIBNAME.so $LDIRS
if [ "$LIBPATH" != "" ]
then
# found it
FOUND=1
# load normally
load-ref-symbols
load-dynamic
CMD="$CMD -l$LIBNAME"
fi
fi
# try static only
if [ $FOUND -eq 0 ]
then
find-lib $LIBNAME.a $LDIRS
if [ "$LIBPATH" != "" ]
then
# found it
FOUND=1
# add it to dependencies
DEPS="$DEPS $LIBPATH"
# load static
load-static
load-all-symbols
CMD="$CMD -l$LIBNAME"
fi
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
# set load to normal
load-ref-symbols
load-dynamic
CMD="$CMD -l$LIBNAME"
fi
;;
-s*)
# force static load
FOUND=0
find-lib $LIBNAME.a $LDIRS
if [ "$LIBPATH" != "" ]
then
# found it
FOUND=1
# add it to dependencies
DEPS="$DEPS $LIBPATH"
# load static
load-static
load-all-symbols
CMD="$CMD -l$LIBNAME"
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
# set load to static
load-static
load-all-symbols
CMD="$CMD -l$LIBNAME"
fi
;;
-d*)
# only dynamic linkage
FOUND=0
if [ $STATIC -eq 0 ]
then
find-lib $LIBNAME.so $LDIRS
if [ "$LIBPATH" != "" ]
then
# found it
FOUND=1
# load normally
load-ref-symbols
load-dynamic
CMD="$CMD -l$LIBNAME"
fi
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
# set load to normal
load-ref-symbols
load-dynamic
CMD="$CMD -l$LIBNAME"
fi
;;
esac
done
fi
# put state back to normal
load-ref-symbols
load-dynamic
# produce shared library
echo $CMD
$CMD || exit $?
# produce dependencies
if [ "$DEPFILE" != "" ]
then
echo "$TARG: $DEPS" > "$DEPFILE"
fi
sra_sdk-2.1.7/build/ld.mac.exe.sh 0000755 0012213 0011620 00000012713 11576721672 016231 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# ===========================================================================
# input library types, and their handling
#
# normal linkage
# -l : find shared or static
# -s : require static
# -d : ignore - will be dynamically loaded
#
# static linkage
# -l : require static
# -s : require static
# -d : require static
# ===========================================================================
# script name
SELF_NAME="$(basename $0)"
# parameters and common functions
source "${0%exe.sh}cmn.sh"
# discover tool chain
case "$LD" in
g*)
source "${0%exe.sh}gcc.sh"
;;
i*)
source "${0%exe.sh}icc.sh"
;;
*)
echo "$SELF_NAME: unrecognized ld tool - '$LD'"
exit 5
esac
# EXE_CMD was started in tool-specific source
CMD="$EXE_CMD $LDFLAGS"
# if building a static executable against dynamic libraries
# the main application will substitute for name lookup
if [ $STATIC -eq 1 ] && [ $DYLD -eq 1 ]
then
CMD="$CMD $LD_EXPORT_GLOBAL $LD_MULTIPLE_DEFS"
fi
# tack on object files
CMD="$CMD $OBJS"
# initial dependency upon Makefile and vers file
DEPS="$SRCDIR/Makefile $VERSFILE"
if [ "$LIBS" != "" ]
then
# tack on paths
DIRS="$LDIRS:$XDIRS"
while [ "$DIRS" != "" ]
do
DIR="${DIRS%%:*}"
[ "$DIR" != "" ] && CMD="$CMD -L$DIR"
DIRS="${DIRS#$DIR}"
DIRS="${DIRS#:}"
done
# tack on libraries, finding as we go
for LIB in $LIBS
do
# strip off switch
LIBNAME="${LIB#-[lsd]}"
# look at linkage
case "$LIB" in
-l*)
# normal or dynamic linkage
FOUND=0
if [ $STATIC -eq 0 ]
then
find-lib $LIBNAME.dylib $LDIRS
if [ "$LIBPATH" != "" ]
then
# found it
FOUND=1
# load dynamic
load-dynamic
CMD="$CMD -l$LIBNAME"
fi
fi
# try static only
if [ $FOUND -eq 0 ]
then
find-lib $LIBNAME.a $LDIRS
if [ "$LIBPATH" != "" ]
then
# found it
FOUND=1
# add it to dependencies
DEPS="$DEPS $LIBPATH"
# load static
CMD="$CMD $LIBPATH"
fi
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
[ $STATIC -eq 1 ] && load-ref-symbols
load-dynamic
CMD="$CMD -l$LIBNAME"
fi
;;
-s*)
# force static load
FOUND=0
find-lib $LIBNAME.a $LDIRS
if [ "$LIBPATH" != "" ]
then
# found it
FOUND=1
# add it to dependencies
DEPS="$DEPS $LIBPATH"
# load library directly
CMD="$CMD $LIBPATH"
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
# set load to static
load-static
[ $STATIC -eq 1 ] && load-all-symbols
CMD="$CMD -l$LIBNAME"
fi
;;
-d*)
FOUND=0
if [ $STATIC -eq 1 ]
then
find-lib $LIBNAME.a $LDIRS
if [ "$LIBPATH" != "" ]
then
# found it
FOUND=1
# add it to dependencies
DEPS="$DEPS $LIBPATH"
# load static
load-static
load-all-symbols
CMD="$CMD $LIBPATH"
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
load-static
load-all-symbols
CMD="$CMD -l$LIBNAME"
fi
fi
;;
esac
done
fi
# return to normal
load-ref-symbols
load-dynamic
# produce shared library
echo $CMD
$CMD || exit $?
# produce dependencies
if [ "$DEPFILE" != "" ]
then
echo "$TARG: $DEPS" > "$DEPFILE"
fi
sra_sdk-2.1.7/build/ld.mac.ln.sh 0000755 0012213 0011620 00000005012 11506455277 016051 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# script name
SELF_NAME="$(basename $0)"
# parameters
TYPE="$1"
OUTDIR="$2"
TARG="$3"
NAME="$4"
DBGAP="$5"
EXT="$6"
VERS="$7"
# find target
TARG=$(basename "$TARG")
# put extension back onto name, unless it's "dylib"
NAME="$NAME$DBGAP"
[ "$EXT" != "" ] && [ "$EXT" != "dylib" ] && NAME="$NAME.$EXT"
# break out version
set-vers ()
{
MAJ=$1
MIN=$2
REL=$3
}
set-vers $(echo $VERS | tr '.' ' ')
cd "$OUTDIR" || exit 5
# assemble versioned names
NAME_MMR="$NAME.$MAJ.$MIN.$REL"
NAME_MM="$NAME.$MAJ.$MIN"
NAME_M="$NAME.$MAJ"
# if extension was "dylib", NOW append to names
if [ "$EXT" = "dylib" ]
then
NAME_MMR="$NAME_MMR.$EXT"
NAME_MM="$NAME_MM.$EXT"
NAME_M="$NAME_M.$EXT"
NAME="$NAME.$EXT"
fi
# create link
create-link ()
{
rm -f "$2"
local CMD="ln -s $1 $2"
echo $CMD
$CMD
}
# test for version in target name
if [ "$TARG" != "$NAME_MMR" ]
then
# for simple name, create 2 links
if [ "$TARG" = "$NAME" ]
then
create-link "$NAME_MMR" "$NAME_M"
create-link "$NAME_M" "$NAME"
# for name with major version in it
elif [ "$TARG" = "$NAME_M" ]
then
create-link "$NAME_MMR" "$NAME_M"
# for name with major & minor version in it
elif [ "$TARG" = "$NAME_MM" ]
then
create-link "$NAME_MMR" "$NAME_MM"
fi
fi
sra_sdk-2.1.7/build/ld.mac.slib.sh 0000755 0012213 0011620 00000006360 11506455277 016400 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# ===========================================================================
# input library types, and their handling
#
# normal or static linkage
# -l : require static
# -s : require static
# -d : ignore
# ===========================================================================
# script name
SELF_NAME="$(basename $0)"
# parameters and common functions
source "${0%slib.sh}cmn.sh"
# initialize command
CMD="ar -rc"
# function to convert an archive into individual object files
convert-static ()
{
# list members
local path="$1"
local mbrs="$(ar -t $path)"
# unpack archive into temporary directory
mkdir -p ld-tmp
if ! cd ld-tmp
then
echo "$SELF_NAME: failed to cd to ld-tmp"
exit 5
fi
ar -x "$path"
# rename and add to source files list
local m=
for m in $mbrs
do
mv $m $NAME-$m
CMD="$CMD ld-tmp/$NAME-$m"
done
# return to prior location
cd - > /dev/null
}
# versioned output
if [ "$VERS" = "" ]
then
CMD="$CMD $TARG"
else
set-vers $(echo $VERS | tr '.' ' ')
CMD="$CMD $OUTDIR/$NAME$DBGAP.a.$VERS"
fi
# tack on object files
CMD="$CMD $OBJS"
# initial dependency upon Makefile and vers file
DEPS="$SRCDIR/Makefile $VERSFILE"
if [ "$LIBS" != "" ]
then
# tack on libraries, finding as we go
for LIB in $LIBS
do
# strip off switch
LIBNAME="${LIB#-[lsd]}"
# look at linkage
case "$LIB" in
-l*|-s*)
# force static load
LIBPATH="$(find-lib $LIBNAME.a $LDIRS)"
if [ "$LIBPATH" != "" ]
then
# add it to dependencies
DEPS="$DEPS $LIBPATH"
# convert to individual object files
convert-static "$LIBPATH" || exit $?
fi
;;
esac
done
fi
# produce static library
echo $CMD
$CMD || exit $?
# remove temporaries
rm -rf ld-tmp
# produce dependencies
if [ "$DEPFILE" != "" ] && [ "$DEPS" != "" ]
then
echo "$TARG: $DEPS" > "$DEPFILE"
fi
sra_sdk-2.1.7/build/ld.sh 0000755 0012213 0011620 00000016720 11625212547 014703 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# prepare script name
SELF_NAME="$(basename $0)"
BUILD_DIR="$(dirname $0)"
TOP="$(dirname $BUILD_DIR)"
SCRIPT_BASE="${0%.sh}"
# os
OS="$1"
shift
# architecture
ARCH="$1"
shift
# binary loader tool
LD="$1"
shift
# configuration
unset SHLX
unset DYLX
unset LIBX
unset OBJX
unset LOBX
# parameters
TYPE=exe
STATIC=0
DYLD=0
STATICSYSLIBS=0
CHECKSUM=0
THREADS=0
KPROC=0
unset BUILD
unset LDIRS
unset XDIRS
unset SRCDIR
unset BINDIR
unset VERSFILE
unset VERSDIR
unset TARG
unset EXT
unset OBJS
unset LIBS
unset DEPFILE
while [ $# -ne 0 ]
do
case "$1" in
--build)
BUILD="$2"
shift
;;
--ldflags)
LDFLAGS="$2"
shift
;;
--static-system-libs)
STATICSYSLIBS=1
;;
--checksum)
CHECKSUM=1
;;
--shlx)
SHLX="$2"
shift
;;
--dylx)
SHLX="$2"
shift
;;
--libx)
LIBX="$2"
shift
;;
--objx)
OBJX="$2"
shift
;;
--srcdir)
SRCDIR="$2"
shift
;;
--bindir)
BINDIR="$2"
shift
;;
-MD)
DEPFILE=1
;;
-L*)
ARG="${1#-L}"
if [ "$ARG" = "" ]
then
ARG="$2"
shift
fi
LDIRS="$LDIRS:$ARG"
;;
-X*)
ARG="${1#-X}"
if [ "$ARG" = "" ]
then
ARG="$2"
shift
fi
XDIRS="$XDIRS:$ARG"
;;
--dlib)
TYPE=dlib
;;
--slib)
TYPE=slib
;;
--stub)
TYPE=stub
;;
--exe)
TYPE=exe
;;
--static)
STATIC=1
;;
--vers)
if [ -f "$2" ]
then
VERSFILE="$2"
elif [ -d "$2" ]
then
VERSDIR="$2"
else
echo "$SELF_NAME: expected version file or source directory"
exit 3
fi
shift
;;
-o*)
ARG="${1#-o}"
if [ "$ARG" = "" ]
then
ARG="$2"
shift
fi
TARG="$ARG"
;;
-lpthread|-spthread|-dpthread)
THREADS=8
;;
-lkproc)
LIBS="$LIBS $1"
KPROC=4
;;
-skproc)
LIBS="$LIBS $1"
THREADS=8
KPROC=4
;;
-l*|-s*)
LIBS="$LIBS $1"
;;
-dkproc)
LIBS="$LIBS $1"
KPROC=4
DYLD=2
;;
-d*)
LIBS="$LIBS $1"
DYLD=2
;;
*.$OBJX)
OBJS="$OBJS $1"
;;
esac
shift
done
# correct for prefixes
LDIRS="${LDIRS#:}"
XDIRS="${XDIRS#:}"
LIBS="${LIBS# }"
OBJS="${OBJS# }"
# split target
OUTDIR=$(dirname "$TARG")
NAME=$(basename "$TARG")
# dependency file
[ "$DEPFILE" != "" ] && DEPFILE="$NAME.$TYPE.d"
# parse target
if [ "$TYPE" = "dlib" ] && [ "$DYLX" != "" ]
then
EXT="$DYLX"
NAME="${NAME%.$DYLX}"
fi
unset VERS
if [ "$NAME" != "${NAME%.[0-9][0-9]*}" ]
then
ARG="${NAME%.[0-9][0-9]*}"
VERS="${NAME#$ARG}"
NAME="${ARG#.}"
if [ "$NAME" != "${NAME%.[0-9][0-9]*}" ]
then
ARG="${NAME%.[0-9][0-9]*}"
VERS="${NAME#$ARG}.$VERS"
NAME="${ARG#.}"
if [ "$NAME" != "${NAME%.[0-9][0-9]*}" ]
then
ARG="${NAME%.[0-9][0-9]*}"
VERS="${NAME#$ARG}.$VERS"
NAME="${ARG#.}"
fi
fi
fi
case "$TYPE" in
dlib)
if [ "$SHLX" != "" ]
then
EXT="$SHLX"
NAME="${NAME%.$SHLX}"
fi
;;
slib)
EXT="$LIBX"
NAME="${NAME%.$LIBX}"
esac
unset DBGAP
if [ "$NAME" != "${NAME%-dbgap}" ]
then
DBGAP=-dbgap
NAME="${NAME%-dbgap}"
fi
# locate version file and version
[ "$VERSDIR" != "" ] && VERSFILE="$VERSDIR/$NAME.vers"
if [ "$VERSFILE" != "" ]
then
if [ ! -f "$VERSFILE" ]
then
echo "$SELF_NAME: warning - creating version file '$VERSFILE'"
echo 1.0.0 > $VERSFILE
fi
if [ ! -r "$VERSFILE" ]
then
echo "$SELF_NAME: version file '$VERSFILE' is unreadable"
exit 5
fi
ARG=$(cat $VERSFILE)
if [ "$VERS" != "" ] && [ "$VERS" != "$ARG" ]
then
echo "$SELF_NAME: version from file '$VERSFILE' does not match '$VERS'"
exit 5
fi
VERS="$ARG"
fi
#echo "# $SELF_NAME"
#echo "# BUILD : $BUILD"
#echo "# OS : $OS"
#echo "# ARCH : $ARCH"
#echo "# tool : $LD"
#echo "# dep file : $DEPFILE"
#echo "# LDFLAGS : $LDFLAGS"
#echo "# static sys libs: $STATICSYSLIBS"
#echo "# checksum : $CHECKSUM"
#echo "# static : $STATIC"
#echo "# kproc : $KPROC"
#echo "# thread libs : $THREADS"
#echo "# type : $TYPE"
#echo "# srcdir : $SRCDIR"
#echo "# bindir : $BINDIR"
#echo "# LDIRS : $LDIRS"
#echo "# XDIRS : $XDIRS"
#echo "# vers file : $VERSFILE"
#echo "# vers dir : $VERSDIR"
#echo "# target : $TARG"
#echo "# outdir : $OUTDIR"
#echo "# name : $NAME"
#echo "# dbgap : $DBGAP"
#echo "# extension : $EXT"
#echo "# version : $VERS"
#echo "# objects : $OBJS"
#echo "# libraries : $LIBS"
#echo "# script-base : $SCRIPT_BASE"
# overwrite dependencies
[ -f "$DEPFILE" ] && rm -f "$DEPFILE"
# generate mode
[ $STATIC -ne 0 ] && [ $KPROC -ne 0 ] && THREADS=8
MODE=$(expr $THREADS + $KPROC + $DYLD + $STATIC)
# generate SCM flags
SCMFLAGS=$(expr $STATICSYSLIBS + $STATICSYSLIBS + $CHECKSUM)
# perform link
"$SCRIPT_BASE.$OS.$TYPE.sh" "$LD" "$ARCH" "$BUILD" "$SRCDIR" "$BINDIR" "$OUTDIR" \
"$TARG" "$NAME" "$DBGAP" "$VERS" "$VERSFILE" "$DEPFILE" "$MODE" "$SCMFLAGS" \
"$LDFLAGS" "$LDIRS" "$XDIRS" "$OBJS" "$LIBS" || exit $?
# establish links
if [ "$VERS" != "" ] && [ "$OS" != "win" ]
then
$SCRIPT_BASE.$OS.ln.sh "$TYPE" "$OUTDIR" "$TARG" "$NAME" "$DBGAP" "$EXT" "$VERS"
fi
# SCM
if [ $CHECKSUM -eq 1 ] && [ "$OS" = "linux" ]
then
# calling the scm-version-script
# parameters are: module-name, current-md5-file, version-file
if [ $TYPE = "dlib" ] || [ $TYPE = "exe" ] || [ $STATIC -eq 1 ]
then
SCM_DIR="$TOP/scm"
LOGFILE="$SCM_DIR/scm.log"
SCMD="$BUILD_DIR/scm.sh $NAME $TARG.md5 $VERSFILE"
echo "$SCMD" >> $LOGFILE
$SCMD
fi
fi
sra_sdk-2.1.7/build/ld.unix.cmn.sh 0000755 0012213 0011620 00000005777 11556621243 016453 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# script name
SELF_NAME="$(basename $0)"
# parameters
LD="$1"
shift
SRCDIR="$1"
OUTDIR="$2"
TARG="$3"
NAME="$4"
DBGAP="$5"
shift 5
VERS="$1"
VERSFILE="$2"
DEPFILE="$3"
shift 3
MODE="$1"
SCMFLAGS="$2"
LDFLAGS="$3"
shift 3
LDIRS="$1"
XDIRS="$2"
shift 2
OBJS="$1"
LIBS="$2"
# decode MODE
STATIC=$(expr $MODE % 2)
DYLD=$(expr $MODE / 2)
# decode SCMFLAGS
CHECKSUM=$(expr $SCMFLAGS % 2)
STATICSYSLIBS=$(expr $SCMFLAGS / 2)
# return parameter for find-lib
LIBPATH=''
# initial command state
CMD=''
LD_STATIC_STATE=0
LD_ALL_STATE=0
# for breaking out version
set-vers ()
{
MAJ=$1
MIN=$2
REL=$3
}
# for locating libraries
find-lib ()
{
_lib="lib$1"
_dirs="$2"
LIBPATH=''
while [ "$_dirs" != "" ]
do
_dir="${_dirs%%:*}"
if [ "$_dir" != "" ]
then
if [ -e "$_dir/$_lib" ]
then
while [ -L "$_dir/$_lib" ]
do
_lib=$(stat -c '%N' "$_dir/$_lib" | tr "\`\'" " ")
_lib="${_lib#*->}"
_lib="lib${_lib# *lib}"
_lib="${_lib%% *}"
done
LIBPATH="$_dir/$_lib"
break;
fi
fi
_dirs="${_dirs#$_dir}"
_dirs="${_dirs#:}"
done
}
# setting state
load-static ()
{
if [ $LD_STATIC_STATE -eq 0 ]
then
CMD="$CMD $LD_STATIC"
LD_STATIC_STATE=1
fi
}
load-dynamic ()
{
if [ $LD_STATIC_STATE -eq 1 ]
then
CMD="$CMD $LD_DYNAMIC"
LD_STATIC_STATE=0
fi
}
load-all-symbols ()
{
if [ $LD_ALL_STATE -eq 0 ]
then
CMD="$CMD $LD_ALL_SYMBOLS"
LD_ALL_STATE=1
fi
}
load-ref-symbols ()
{
if [ $LD_ALL_STATE -eq 1 ]
then
CMD="$CMD $LD_REF_SYMBOLS"
LD_ALL_STATE=0
fi
}
sra_sdk-2.1.7/build/ld.unix.slib.sh 0000755 0012213 0011620 00000006207 11506455277 016623 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# ===========================================================================
# input library types, and their handling
#
# normal or static linkage
# -l : require static
# -s : require static
# -d : ignore
# ===========================================================================
# initialize command
CMD="ar -rc"
# function to convert an archive into individual object files
convert-static ()
{
# list members
local path="$1"
local mbrs="$(ar -t $path)"
# unpack archive into temporary directory
mkdir -p ld-tmp
if ! cd ld-tmp
then
echo "$SELF_NAME: failed to cd to ld-tmp"
exit 5
fi
ar -x "$path"
# rename and add to source files list
local m=
for m in $mbrs
do
mv $m $NAME-$m
CMD="$CMD ld-tmp/$NAME-$m"
done
# return to prior location
cd - > /dev/null
}
# versioned output
if [ "$VERS" = "" ]
then
CMD="$CMD $TARG"
else
set-vers $(echo $VERS | tr '.' ' ')
CMD="$CMD $OUTDIR/$NAME$DBGAP.a.$VERS"
fi
# tack on object files
CMD="$CMD $OBJS"
# initial dependency upon Makefile and vers file
DEPS="$SRCDIR/Makefile $VERSFILE"
if [ "$LIBS" != "" ]
then
# tack on libraries, finding as we go
for LIB in $LIBS
do
# strip off switch
LIBNAME="${LIB#-[lsd]}"
# look at linkage
case "$LIB" in
-l*|-s*)
# force static load
LIBPATH="$(find-lib $LIBNAME.a $LDIRS)"
if [ "$LIBPATH" != "" ]
then
# add it to dependencies
DEPS="$DEPS $LIBPATH"
# convert to individual object files
convert-static "$LIBPATH" || exit $?
fi
;;
esac
done
fi
# produce static library
echo $CMD
$CMD || exit $?
# remove temporaries
rm -rf ld-tmp
# produce dependencies
if [ "$DEPFILE" != "" ] && [ "$DEPS" != "" ]
then
echo "$TARG: $DEPS" > "$DEPFILE"
fi
sra_sdk-2.1.7/build/ld.win.cmn.sh 0000755 0012213 0011620 00000005657 11625212550 016254 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# script name
SELF_NAME="$(basename $0)"
# parameters
LD="$1"
ARCH="$2"
BUILD="$3"
shift 3
SRCDIR="$1"
BINDIR="$2"
OUTDIR="$3"
TARG="$4"
NAME="$5"
DBGAP="$6"
shift 6
VERS="$1"
VERSFILE="$2"
DEPFILE="$3"
shift 3
MODE="$1"
SCMFLAGS="$2"
LDFLAGS="$3"
shift 3
LDIRS="$1"
XDIRS="$2"
shift 2
OBJS="$1"
LIBS="$2"
# decode MODE
STATIC=$(expr $MODE % 2)
MODE=$(expr $MODE / 2)
DYLD=$(expr $MODE % 2)
MODE=$(expr $MODE / 2)
KPROC=$(expr $MODE % 2)
THREADS=$(expr $MODE / 2)
##### TEMPORARY #####
KPROC=0
THREADS=0
#####################
# decode SCMFLAGS
CHECKSUM=$(expr $SCMFLAGS % 2)
STATICSYSLIBS=$(expr $SCMFLAGS / 2)
# return parameter for find-lib
xLIBPATH=''
# initial command state
CMD=''
LD_STATIC_STATE=0
LD_ALL_STATE=0
# for breaking out version
set-vers ()
{
MAJ=$1
MIN=$2
REL=$3
}
# for locating libraries
find-lib ()
{
_lib="lib$1"
_dirs="$2"
xLIBPATH=''
while [ "$_dirs" != "" ]
do
_dir="${_dirs%%:*}"
if [ "$_dir" != "" ]
then
if [ -e "$_dir/$_lib" ]
then
xLIBPATH="$_dir/$_lib"
break;
fi
fi
_dirs="${_dirs#$_dir}"
_dirs="${_dirs#:}"
done
}
# setting state
load-static ()
{
if [ $LD_STATIC_STATE -eq 0 ]
then
CMD="$CMD $LD_STATIC"
LD_STATIC_STATE=1
fi
}
load-dynamic ()
{
if [ $LD_STATIC_STATE -eq 1 ]
then
CMD="$CMD $LD_DYNAMIC"
LD_STATIC_STATE=0
fi
}
load-all-symbols ()
{
if [ $LD_ALL_STATE -eq 0 ]
then
CMD="$CMD $LD_ALL_SYMBOLS"
LD_ALL_STATE=1
fi
}
load-ref-symbols ()
{
if [ $LD_ALL_STATE -eq 1 ]
then
CMD="$CMD $LD_REF_SYMBOLS"
LD_ALL_STATE=0
fi
}
sra_sdk-2.1.7/build/ld.win.exe.sh 0000755 0012213 0011620 00000017131 11625212550 016246 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# ===========================================================================
# input library types, and their handling
#
# normal linkage
# -l : find shared or static
# -s : require static
# -d : ignore - will be dynamically loaded
#
# static linkage
# -l : require static
# -s : require static
# -d : require static
# ===========================================================================
# script name
SELF_NAME="$(basename $0)"
# parameters and common functions
source "${0%exe.sh}cmn.sh"
# discover tool chain
case "$LD" in
link)
source "${0%exe.sh}vc++.sh"
;;
*)
echo "$SELF_NAME: unrecognized ld tool - '$LD'"
exit 5
esac
# EXE_CMD was started in tool-specific source
CMD="$EXE_CMD $LDFLAGS OLE32.lib"
# if building a static executable against dynamic libraries
# the main application will substitute for name lookup
if [ $STATIC -eq 1 ] && [ $DYLD -eq 1 ]
then
CMD="$CMD $LD_EXPORT_GLOBAL $LD_MULTIPLE_DEFS"
fi
# function to convert static libraries to individual COFF files
convert-static ()
{
if [ $STATIC -eq 0 ]
then
CMD="$CMD $2.a"
else
# list members
local path="$1"
local mbrs="$(ar -t $path)"
# create sub directory
rm -rf "$2" && mkdir "$2"
if ! cd "$2"
then
echo "$SELF_NAME: failed to cd to $2"
exit 5
fi
ar -x "$path"
# add source files to link
local m=
for m in $mbrs
do
CMD="$CMD $2/$m"
done
# return to prior location
cd - > /dev/null
fi
}
# tack on object files
CMD="$CMD $(cygpath -w $OBJS)"
# initial dependency upon Makefile - no vers file on Windows
DEPS="$SRCDIR/Makefile"
if [ "$LIBS" != "" ]
then
# tack on paths
DIRS="$LDIRS:$XDIRS"
while [ "$DIRS" != "" ]
do
DIR="${DIRS%%:*}"
[ "$DIR" != "" ] && CMD="$CMD /LIBPATH:$(cygpath -w $DIR)"
DIRS="${DIRS#$DIR}"
DIRS="${DIRS#:}"
done
HAVE_KERNEL32=0
HAVE_WS2=0
HAVE_CLIB=0
if [ $THREADS -ne 0 ] || [ $KPROC -ne 0 ]
then
if [ $STATIC -ne 0 ]
then
CMD="$CMD /MT"
else
CMD="$CMD /MD"
fi
fi
# tack on libraries, finding as we go
for xLIB in $LIBS
do
# strip off switch
xLIBNAME="${xLIB#-[lsd]}"
# map xLIBNAME
case "$xLIBNAME" in
dl)
if [ $HAVE_KERNEL32 -ne 1 ]
then
load-ref-symbols
load-dynamic
CMD="$CMD Kernel32.lib"
HAVE_KERNEL32=1
fi
continue
;;
ws2)
if [ $HAVE_WS2 -ne 1 ]
then
load-ref-symbols
load-dynamic
CMD="$CMD ws2_32.lib"
HAVE_WS2=1
fi
continue
;;
# redirect libm to link against libc.lib in case of windows
# omitting the lib defaults to linking against libc.lib
m)
if [ $HAVE_CLIB -ne 1 ]
then
load-ref-symbols
load-dynamic
HAVE_CLIB=1
fi
continue
;;
##### TEMPORARY #####
# skip kproc
kproc)
continue
;;
#####################
esac
# look at linkage
case "$xLIB" in
-l*)
# normal or dynamic linkage
FOUND=0
if [ $STATIC -eq 0 ]
then
find-lib $xLIBNAME.lib $LDIRS
if [ "$xLIBPATH" != "" ]
then
# found it
FOUND=1
# load dynamic
load-dynamic
CMD="$CMD lib$xLIBNAME.lib"
fi
fi
# try static only
if [ $FOUND -eq 0 ]
then
find-lib $xLIBNAME.a $LDIRS
if [ "$xLIBPATH" != "" ]
then
# found it
FOUND=1
# add it to dependencies
DEPS="$DEPS $xLIBPATH"
# load static
load-static
[ $STATIC -eq 1 ] && load-all-symbols
convert-static "$xLIBPATH" "lib$xLIBNAME"
fi
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
[ $STATIC -eq 1 ] && load-ref-symbols
load-dynamic
CMD="$CMD lib$xLIBNAME.lib"
fi
;;
-s*)
# force static load
FOUND=0
find-lib $xLIBNAME.a $LDIRS
if [ "$xLIBPATH" != "" ]
then
# found it
FOUND=1
# add it to dependencies
DEPS="$DEPS $xLIBPATH"
# load static
load-static
[ $STATIC -eq 1 ] && load-all-symbols
convert-static "$xLIBPATH" "lib$xLIBNAME"
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
# set load to static
load-static
[ $STATIC -eq 1 ] && load-all-symbols
CMD="$CMD lib$xLIBNAME.lib"
fi
;;
-d*)
FOUND=0
if [ $STATIC -eq 1 ]
then
find-lib $xLIBNAME.a $LDIRS
if [ "$xLIBPATH" != "" ]
then
# found it
FOUND=1
# add it to dependencies
DEPS="$DEPS $xLIBPATH"
# load static
load-static
load-all-symbols
convert-static "$xLIBPATH" "lib$xLIBNAME"
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
load-static
load-all-symbols
CMD="$CMD lib$xLIBNAME"
fi
fi
;;
esac
done
fi
# return to normal
load-ref-symbols
load-dynamic
# produce shared library
echo $CMD
$CMD || exit $?
# produce dependencies
if [ "$DEPFILE" != "" ]
then
echo "$TARG: $DEPS" > "$DEPFILE"
fi
# cleanup temporary files
rm -f $TARG.lib $TARG.exp
sra_sdk-2.1.7/build/ld.win.slib.sh 0000755 0012213 0011620 00000006732 11506455277 016440 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# ===========================================================================
# input library types, and their handling
#
# normal or static linkage
# -l : require static
# -s : require static
# -d : ignore
# ===========================================================================
# script name
SELF_NAME="$(basename $0)"
# parameters and common functions
source "${0%slib.sh}cmn.sh"
# initialize command
if [ $STATIC -eq 0 ]
then
CMD="lib /NOLOGO"
else
CMD="ar -rc"
fi
# function to convert an archive into individual object files
convert-static ()
{
if [ $STATIC -eq 0 ]
then
CMD="$CMD $(cygpath -w $1)"
else
# list members
local path="$1"
local mbrs="$(ar -t $path)"
# unpack archive into temporary directory
mkdir -p ld-tmp
if ! cd ld-tmp
then
echo "$SELF_NAME: failed to cd to ld-tmp"
exit 5
fi
ar -x "$path"
# rename and add to source files list
local m=
for m in $mbrs
do
mv $m $NAME-$m
CMD="$CMD ld-tmp/$NAME-$m"
done
# return to prior location
cd - > /dev/null
fi
}
if [ $STATIC -eq 0 ]
then
# no versioned output here, sorry
CMD="$CMD /OUT:$(cygpath -w $TARG)"
# tack on object files
CMD="$CMD $(cygpath -w $OBJS)"
else
CMD="$CMD $TARG $OBJS"
fi
# initial dependency upon Makefile and vers file
DEPS="$SRCDIR/Makefile"
if [ "$LIBS" != "" ]
then
# tack on libraries, finding as we go
for xLIB in $LIBS
do
# strip off switch
xLIBNAME="${xLIB#-[lsd]}"
# look at linkage
case "$xLIB" in
-l*|-s*)
# force static load
xLIBPATH="$(find-lib $xLIBNAME.lib $LDIRS)"
if [ "$xLIBPATH" != "" ]
then
# add it to dependencies
DEPS="$DEPS $xLIBPATH"
# convert to individual object files
convert-static "$xLIBPATH" || exit $?
fi
;;
esac
done
fi
# produce static library
echo $CMD
$CMD || exit $?
# remove temporaries
rm -rf ld-tmp
# produce dependencies
if [ "$DEPFILE" != "" ] && [ "$DEPS" != "" ]
then
echo "$TARG: $DEPS" > "$DEPFILE"
fi
sra_sdk-2.1.7/build/ld.win.stub.sh 0000755 0012213 0011620 00000003637 11506455277 016465 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# ===========================================================================
# input library types, and their handling
#
# normal linkage
# -l : find shared or static
# -s : require static
# -d : require shared
#
# static linkage
# -l : require static
# -s : require static
# -d : ignore
# ===========================================================================
# script name
SELF_NAME="$(basename $0)"
# parameters and common functions
source "${0%stub.sh}cmn.sh"
# discover tool chain
case "$LD" in
link)
source "${0%stub.sh}vc++.sh"
;;
*)
echo "$SELF_NAME: unrecognized ld tool - '$LD'"
exit 5
esac
# produce stub library and exp file
echo $STUB_CMD
$STUB_CMD
sra_sdk-2.1.7/build/ld.win.vc++.sh 0000755 0012213 0011620 00000004433 11506455277 016241 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# define linker params
LD_EXPORT_GLOBAL=""
LD_MULTIPLE_DEFS="/FORCE:MULTIPLE"
LD_STATIC=""
LD_DYNAMIC=""
LD_ALL_SYMBOLS="/OPT:NOREF"
LD_REF_SYMBOLS="/OPT:REF"
# rewrite PATH variable
unset CYGP
while [ "$PATH" = "${PATH#/cygdrive}" ]
do
DIR="${PATH%%:*}"
PATH="${PATH#$DIR}"
PATH="${PATH#:}"
CYGP="$CYGP:$DIR"
done
PATH="$PATH$CYGP"
export PATH
# the def file
unset DEF_SWITCH
DEF_FILE="$SRCDIR/$NAME-$BUILD.def"
[ ! -f "$DEF_FILE" ] && DEF_FILE="$SRCDIR/$NAME.def"
[ -f "$DEF_FILE" ] && DEF_SWITCH="/DEF:$(cygpath -w $DEF_FILE)" || unset DEF_FILE
# the full path to target sans extension
WINTARG="$(cygpath -w ${TARG%.lib})"
# build command
STUB_CMD="lib /NOLOGO /MACHINE:x86 $DEF_SWITCH /OUT:$WINTARG.lib"
DLIB_CMD="$LD /NOLOGO /DLL $DEF_SWITCH /OUT:$WINTARG.dll /STACK:8000000 /HEAP:1000000000"
EXE_CMD="$LD /NOLOGO /OUT:$WINTARG.exe /SUBSYSTEM:CONSOLE /ENTRY:wmainCRTStartup /STACK:8000000 /HEAP:100000000"
# tack on PDB tracking
if [ "$BUILD" = "dbg" ]
then
DLIB_CMD="$DLIB_CMD /DEBUG /PDB:$WINTARG.pdb"
EXE_CMD="$EXE_CMD /DEBUG /PDB:$WINTARG.pdb"
fi
sra_sdk-2.1.7/build/sra-dflt-schema.sh 0000755 0012213 0011620 00000004747 11506455277 017273 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# prepare script name
SELF_NAME="$(basename $0)"
SCRIPT_BASE="${0%.sh}"
# os
OS="$1"
shift
# binary compiler
CC="$1"
shift
# everything except windows is fine as-is
if [ "$OS" != "win" ]
then
echo "$CC $*"
$CC $*
exit $?
fi
# state
unset ARGS
unset DEPENDENCIES
unset DEPTARG
unset TARG
# process parameters for windows
while [ $# -ne 0 ]
do
case "$1" in
-o*)
ARG="${1#-o}"
if [ "$ARG" = "" ]
then
ARG="$2"
shift
fi
TARG="$ARG"
ARG="$(cygpath -w $ARG)"
ARGS="$ARGS -o$ARG"
;;
-I*)
ARG="${1#-I}"
if [ "$ARG" = "" ]
then
ARG="$2"
shift
fi
ARG="$(cygpath -w $ARG)"
ARGS="$ARGS -I$ARG"
;;
-T*)
ARG="${1#-T}"
if [ "$ARG" = "" ]
then
ARG="$2"
shift
fi
DEPTARG="$ARG"
DEPENDENCIES=1
ARG="$(cygpath -w $ARG)"
ARGS="$ARGS -T$ARG"
;;
*)
ARG="$(cygpath -w $1)"
ARGS="$ARGS $ARG"
;;
esac
shift
done
echo "$CC $ARGS"
if ! $CC $ARGS
then
STATUS=$?
rm -f $TARG $DEPTARG
exit $?
fi
if [ $DEPENDENCIES -eq 1 ]
then
# fix this
rm -f $DEPTARG
fi
sra_sdk-2.1.7/build/win-cc.sh 0000755 0012213 0011620 00000006776 11542737113 015475 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# prepare script name
SELF_NAME="$(basename $0)"
SCRIPT_BASE="${0%.sh}"
# os
OS="$1"
shift
# binary compiler
CC="$1"
shift
# configuration
unset TARG
unset ARGS
unset OBJX
unset SRCFILE
unset SOURCES
unset DEPENDENCIES
while [ $# -ne 0 ]
do
case "$1" in
--cflags)
for ARG in $2
do
[ "$ARG" != "${ARG#-}" ] && ARG="/${ARG#-}"
ARGS="$ARGS $ARG"
done
shift
;;
--checksum)
;;
--objx)
OBJX="$2"
shift
;;
-D*)
ARG="${1#-D}"
if [ "$ARG" = "" ]
then
ARG="$2"
shift
fi
ARGS="$ARGS /D$ARG"
;;
-I*)
ARG="${1#-I}"
if [ "$ARG" = "" ]
then
ARG="$2"
shift
fi
ARG="$(cygpath -w $ARG)"
ARGS="$ARGS /I$ARG"
;;
-o*)
ARG="${1#-o}"
if [ "$ARG" = "" ]
then
ARG="$2"
shift
fi
ARGS="$ARGS /Fo$ARG"
TARG="${ARG%.$OBJX}"
;;
-MD)
# the /showIncludes switch will generate
# includes to stderr, but they will need
# to be filtered out and rewritten to the *.d
ARGS="$ARGS /showIncludes"
DEPENDENCIES=1
;;
-fPIC|-std=c99|-ansi|-pedantic)
;;
-*)
ARG="/${1#-}"
ARGS="$ARGS $ARG"
;;
*)
SRCFILE="$(basename $1)"
SOURCES="$SOURCES $1"
ARG="$(cygpath -w $1)"
ARGS="$ARGS $ARG"
;;
esac
shift
done
unset STATUS
CMD="$CC $ARGS"
echo "$CMD"
# run command with redirection
if $CMD > $TARG.out 2> $TARG.err
then
# success
STATUS=0
else
# failure
STATUS=$?
fi
# check for dependencies
if [ "$DEPENDENCIES" = "1" ]
then
sed -e '/including file/!d' -e 's/.*including file: *\([^\r\n][^\r\n]*\)/\1/g' -e '/ /d' $TARG.out > $TARG.inc
echo -n "$TARG.$OBJX: $SOURCES" | sed -e 's/\r//g' > $TARG.d
for inc in $(cat $TARG.inc)
do
echo -n " $(cygpath -u $inc)" | sed -e 's/\r//g' >> $TARG.d
done
fi
# repeat output files but without CR
sed -e 's/\r//g' $TARG.err > /dev/stderr
sed -e 's/\r//g' -e "/^$SRCFILE$/d" -e '/including file/d' $TARG.out
# clean up files
rm -f $TARG.out $TARG.err $TARG.inc
exit $STATUS
sra_sdk-2.1.7/build/mac.arch.sh 0000755 0012213 0011620 00000004651 11645105470 015756 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# PPC or Intel?
ARCH="$(uname -m)"
# the Mac likes to keep its architecture hidden because for all practical
# purposes, it is both 32 and 64 bit, and makes use of emulation as needed.
# does the hardware support 64-bit mode, even in emulation?
CAP64=$(/usr/sbin/sysctl -n hw.cpu64bit_capable)
# real 64-bit hardware has > 32 bits of address space
PADDR_BITS=$(/usr/sbin/sysctl -n machdep.cpu.address_bits.physical)
VADDR_BITS=$(/usr/sbin/sysctl -n machdep.cpu.address_bits.virtual)
# to be 64-bit, it's probably sufficient to test the address space
# but we have the emulation information as well.
if [ $CAP64 -ne 0 ]
then
if [ $PADDR_BITS -gt 32 ] && [ $VADDR_BITS -gt 32 ]
then
# call it 64-bit
if [ "$ARCH" = "i386" ] || [ "$ARCH" = "x86_64" ]
then
echo "x86_64"
exit 0
fi
if [ "$ARCH" = "Power Macintosh" ]
then
echo "ppc64"
exit 0
fi
# unrecognized
echo "unrecognized"
exit 5
fi
fi
# call it 32-bit
if [ "$ARCH" = "i386" ]
then
echo "i386"
exit 0
fi
if [ "$ARCH" = "Power Macintosh" ]
then
echo "ppc32"
exit 0
fi
# unrecognized
echo "unrecognized"
exit 5
sra_sdk-2.1.7/build/ld.win.dlib.sh 0000755 0012213 0011620 00000020004 11625212550 016370 0 ustar rodarmer trace #!/bin/bash
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# ===========================================================================
# input library types, and their handling
#
# normal linkage
# -l : find shared or static
# -s : require static
# -d : require shared
#
# static linkage
# -l : require static
# -s : require static
# -d : ignore
# ===========================================================================
# script name
SELF_NAME="$(basename $0)"
# parameters and common functions
source "${0%dlib.sh}cmn.sh"
# discover tool chain
case "$LD" in
link)
source "${0%dlib.sh}vc++.sh"
;;
*)
echo "$SELF_NAME: unrecognized ld tool - '$LD'"
exit 5
esac
# DLIB_CMD was started in tool-specific source
CMD="$DLIB_CMD $LDFLAGS OLE32.lib"
# function to convert static libraries to individual COFF files
convert-static ()
{
if [ $STATIC -eq 0 ]
then
CMD="$CMD $2.a"
else
# list members
local path="$1"
local mbrs="$(ar -t $path)"
# create sub directory
rm -rf "$2" && mkdir "$2"
if ! cd "$2"
then
echo "$SELF_NAME: failed to cd to $2"
exit 5
fi
ar -x "$path"
# add source files to link
local m=
for m in $mbrs
do
CMD="$CMD $2/$m"
done
# return to prior location
cd - > /dev/null
fi
}
# tack on object files
CMD="$CMD $(cygpath -w $OBJS)"
# initial dependency upon Makefile and vers file
DEPS="$SRCDIR/Makefile $DEF_FILE"
if [ "$LIBS" != "" ]
then
# tack on paths
DIRS="$LDIRS:$XDIRS"
while [ "$DIRS" != "" ]
do
DIR="${DIRS%%:*}"
[ "$DIR" != "" ] && CMD="$CMD /LIBPATH:$(cygpath -w $DIR)"
DIRS="${DIRS#$DIR}"
DIRS="${DIRS#:}"
done
HAVE_KERNEL32=0
HAVE_CLIB=0
if [ $THREADS -ne 0 ] || [ $KPROC -ne 0 ]
then
[ $STATIC -eq 0 ] && CMD="$CMD /MD"
fi
# tack on libraries, finding as we go
for xLIB in $LIBS
do
# strip off switch
xLIBNAME="${xLIB#-[lsd]}"
# map xLIBNAME
case "$xLIBNAME" in
# redirect libdl to link against Kernel32.lib in case of windows
dl)
if [ $HAVE_KERNEL32 -ne 1 ]
then
load-ref-symbols
load-dynamic
CMD="$CMD Kernel32.lib"
HAVE_KERNEL32=1
fi
continue
;;
# redirect libm to link against libc.lib in case of windows
# omitting the lib defaults to linking against libc.lib
m)
if [ $HAVE_CLIB -ne 1 ]
then
load-ref-symbols
load-dynamic
HAVE_CLIB=1
fi
continue
;;
##### TEMPORARY #####
# skip kproc
kproc)
continue
;;
#####################
esac
# look at linkage
case "$xLIB" in
-l*)
# normal or dynamic linkage
FOUND=0
if [ $STATIC -eq 0 ]
then
find-lib $xLIBNAME.lib $LDIRS
if [ "$xLIBPATH" != "" ]
then
# found it
FOUND=1
# load normally
load-ref-symbols
load-dynamic
CMD="$CMD lib$xLIBNAME.lib"
fi
fi
# try static only
if [ $FOUND -eq 0 ]
then
find-lib $xLIBNAME.a $LDIRS
if [ "$xLIBPATH" != "" ]
then
# found it
FOUND=1
# add it to dependencies
DEPS="$DEPS $xLIBPATH"
# load static
load-static
load-all-symbols
convert-static "$xLIBPATH" "lib$xLIBNAME"
fi
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
# set load to normal
load-ref-symbols
load-dynamic
CMD="$CMD lib$xLIBNAME.lib"
fi
;;
-s*)
# force static load
FOUND=0
find-lib $xLIBNAME.a $LDIRS
if [ "$xLIBPATH" != "" ]
then
# found it
FOUND=1
# add it to dependencies
DEPS="$DEPS $xLIBPATH"
# load static
load-static
load-all-symbols
convert-static "$xLIBPATH" "lib$xLIBNAME"
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
# set load to static
load-static
load-all-symbols
CMD="$CMD lib$xLIBNAME.lib"
fi
;;
-d*)
# only dynamic linkage
FOUND=0
if [ $STATIC -eq 0 ]
then
find-lib $xLIBNAME.lib $LDIRS
if [ "$xLIBPATH" != "" ]
then
# found it
FOUND=1
# load normally
load-ref-symbols
load-dynamic
CMD="$CMD lib$xLIBNAME.lib"
fi
fi
# try static if performing static build
# because we HAVE to link against something,
# and the dependency code is being statically
# linked into an executable...
if [ $FOUND -eq 0 ] && [ $STATIC -eq 1 ]
then
find-lib $xLIBNAME.a $LDIRS
if [ "$xLIBPATH" != "" ]
then
# found it
FOUND=1
# add it to dependencies
DEPS="$DEPS $xLIBPATH"
# load static
load-static
load-all-symbols
convert-static "$xLIBPATH" "lib$xLIBNAME"
fi
fi
# not found within our directories
if [ $FOUND -eq 0 ]
then
# set load to normal
load-ref-symbols
load-dynamic
CMD="$CMD lib$xLIBNAME.lib"
fi
;;
esac
done
fi
# put state back to normal
load-ref-symbols
load-dynamic
# produce shared library, stub library and exp file
echo $CMD
if ! $CMD
then
STATUS=$?
rm -f "$TARG" "${TARG%lib}dll"
exit $STATUS
fi
# copy dll to binary directory, so they can be found by the executables
# leave the dll in it's original place, so that they can be found in /mod and /wmod too
cp "${TARG%lib}dll" "$BINDIR"
# produce dependencies
if [ "$DEPFILE" != "" ]
then
echo "$TARG: $DEPS" > "$DEPFILE"
fi
sra_sdk-2.1.7/build/Makefile.mac 0000644 0012213 0011620 00000003635 11476747337 016163 0 ustar rodarmer trace # ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# default compiler
ifeq (,$(COMP))
COMP = gcc
endif
# architecture
xARCH = $(shell test -f $(TOP)/build/ARCH.mac && cat $(TOP)/build/ARCH.mac)
ifneq (,$(xARCH))
# the user has selected an architecture
ifeq (i386,$(xARCH))
ARCH = i386
BITS = 32
endif
ifeq (x86_64,$(xARCH))
ARCH = x86_64
BITS = 64
endif
endif
# allow the user to override architecture
i386 x86_64:
@ echo $@ > $(TOP)/build/ARCH.mac
.PHONY: i386 x86_64
# library prefix
LPFX = lib
# file extensions
OBJX = o
LOBX = pic.o
LIBX = a
SHLX = dylib
# compilation defines
DEFINES := -DMAC -DBSD -DUNIX -D_REENTRANT -D_FILE_OFFSET_BITS=64
# Darwin is a Unix variant
OS_DAD = bsd
OS_GDAD = unix
LIBXML_LPATH = /usr/lib
sra_sdk-2.1.7/build/COMP.mac 0000644 0012213 0011620 00000000004 11477732762 015164 0 ustar rodarmer trace gcc
sra_sdk-2.1.7/build/BUILD.win 0000644 0012213 0011620 00000000004 11625267705 015315 0 ustar rodarmer trace pub
sra_sdk-2.1.7/build/COMP.win 0000644 0012213 0011620 00000000005 11477733000 015204 0 ustar rodarmer trace vc++
sra_sdk-2.1.7/doc/ 0000775 0012213 0011620 00000000000 11477730356 013417 5 ustar rodarmer trace sra_sdk-2.1.7/doc/help/ 0000755 0012213 0011620 00000000000 11477730356 014345 5 ustar rodarmer trace sra_sdk-2.1.7/doc/help/html/ 0000755 0012213 0011620 00000000000 11477730356 015311 5 ustar rodarmer trace sra_sdk-2.1.7/doc/help/html/abi-dump-help.html 0000644 0012213 0011620 00000003717 11627507276 020633 0 ustar rodarmer trace
abi-dump help
Usage:
abi-dump [options] [ -A ] <accession>
abi-dump [options] <path>
-A|--accession <accession> Replaces accession derived from <path> in filename(s) and deflines
Options:
-O|--outdir <path> Output directory, default is '.'
-N|--minSpotId <rowid> Minimum spot id
-X|--maxSpotId <rowid> Maximum spot id
-G|--spot-group Split into files by SPOT_GROUP (member name)
--spot-groups <[list]> Filter by SPOT_GROUP (member): name[,...]
-R|--read-filter <[filter]> Split into files by READ_FILTER value
optionally filter by a value: pass|reject|criteria|redacted
-T|--group-in-dirs Split into subdirectories instead of files
-K|--keep-empty-files Do not delete empty files
--table <table-name> (New) Table name within SRA format, default is SEQUENCE
-h|--help Output a brief explantion for the program
-V|--version Display the version of the program then quit
-L|--log-level <level> Logging level as number or enum string
One of (fatal|sys|int|err|warn|info) or (0-5)
Current/default is warn
-v|--verbose Increase the verbosity level of the program
Use multiple times for more verbosity
Format options:
-M|--minReadLen <len> Minimum read length to output, default is 25
-W|--noclip Do not clip quality left and right for spot
-F|--origfmt Excludes SRR accession on defline
-B|--noDotReads Do not output reads consisting mostly of dots
sra_sdk-2.1.7/doc/help/html/abi-load-help.html 0000644 0012213 0011620 00000003531 11627507276 020577 0 ustar rodarmer trace
abi-load help
Usage:
abi-load [options] -r run.xml -e experiment.xml -o output-path
-r|--run-xml path to run.xml describing input files
-e|--experiment path to experiment.xml
-o|--output-path target location
Options:
-i|--input-path input files location, default '.'
-u|--input-unpacked input files are unpacked
-f|--force force target overwrite
-n|--spots-number process only given number of spots from input
-b|--bad-spot-number acceptable number of spot creation errors, default is 50
-p|--bad-spot-percentage acceptable percentage of spots creation errors, default is 5
-x|--expected path to expected.xml
-z|--xml-log produce XML-formatted log file
-s|--intensities [on | off] load intensity data, default is off:
Illumina: signal, intensity, noise;
AB SOLiD: signal(s);
LS454: signal, position (for SFF files ON by default).
-h|--help Output a brief explantion for the program.
-V|--version Display the version of the program then quit.
-L|--log-level <level> Logging level as number or enum string.
One of (fatal|sys|int|err|warn|info) or (0-5)
Current/default is warn
-v|--verbose Increase the verbosity level of the program.
Use multiple times for more verbosity.
sra_sdk-2.1.7/doc/help/html/bam-loader-help.html 0000644 0012213 0011620 00000001762 11476747102 021132 0 ustar rodarmer trace
bam-loader help
Usage:
bam-loader 0.0.1
bam-loader [Options] BAMFILE
Load a bam file.
Options:
-o, --output=TABLEPATH REQUIRED: path to a table where the table will be put
-V, --version this will cause the program to emit the internal
version number before any other action
-v, --verbose extra information will be output during
processing second occurrence on the command line
means even more
-h, -?, --help print this message
-l, --log-level=LEVEL the next token will affect the logging level of
the program accepted tokens are the numbers
0-15, fatal, sys, int, err, warn, info
, debug1...debug10
sra_sdk-2.1.7/doc/help/html/copycat-help.html 0000644 0012213 0011620 00000004723 11476747102 020571 0 ustar rodarmer trace
copycat help
copycat : 1.0.6
Usage:
copycat [ ] src-file dst-file
copycat [ ] src-file [src-file...] dst-dir
copycat [ ] -o dst-dir src-file [src-file...]
options:
-x cache-dir location to output cached files
-f force overwrite of existing files
-m magicfile path to the magic file to use
-e extfile path to the extensions file to use
-c classfile path to the file class/type file
behavior is intended to mimic 'cp' to a large extent, in that
a single source file may be copied to a new name, or multiple
source files may be copied to a destination directory.
when the destination directory is specified using 'cp' semantics,
the directory must exist. if specified via '-o' switch, it will be
created if necessary.
the target file may also be a device. in the special case of
/dev/null, it may also act as a directory.
the '-x' option allows small files that are typed as eligible for
caching to be copied to the cache directory provided. the directory
will be created if necessary.
the intent is to capture top-level files, such that files are copied
into the flat cache directory without regard to where they were found
in the input hierarchy. in the case of name conflict, output files will
be renamed.
the class file, magic file and extension file allow new understandings
of files found while cataloging
the magic file is of the type used by the unix/linux 'file' command
the class file assigns file type to classes
the extension file assigns file extensions to file types
existing classes are 'Archive', 'Cached', 'Compressed', 'Read'
Archive and Compresses files are those that have contents that can
be examined - new types must be compiled in
Cached files are those affected by the -x option
Read files are not handled seperately by copy cat except in the catalog
new classes would like Read only be added to the catalog with the class
the format for the class file is lines such as the below
'GnuZipCompressed' with tabs and linefeeds
the format for the extension file is lines such as the below
'gzCompressed' with tabs and linefeeds
sra_sdk-2.1.7/doc/help/html/crc32sum-help.html 0000644 0012213 0011620 00000000532 11476747102 020562 0 ustar rodarmer trace
crc32 help
: usage: crc32sum [] file [file...]
options:
-c check CRC32 against given list
-b open file in binary mode
sra_sdk-2.1.7/doc/help/html/fastq-dump-help.html 0000644 0012213 0011620 00000011366 11627507276 021215 0 ustar rodarmer trace
fastq-dump help
Usage:
fastq-dump [options] [ -A ] <accession>
fastq-dump [options] <path>
INPUT
-A|--accession <accession> Replaces accession derived from <path> in filename(s) and deflines
--table <table-name> (New) Table name within SRA format, default is SEQUENCE
PROCESSING
Read Splitting Sequence data may be used as raw or split into individual reads
--split-spot Split spots into individual reads
Full Spot Filters Applied to the full spot independently of --split-spot
-N|--minSpotId <rowid> Minimum spot id
-X|--maxSpotId <rowid> Maximum spot id
--spot-groups <[list]> Filter by SPOT_GROUP (member): name[,...]
-W|--clip Apply left and right clips
Common Filters Applied to spots when --split-spot is not set, otherwise - to individual reads
-M|--minReadLen <len> Filter by sequence length >= <len>
-R|--read-filter <[filter]> Split into files by READ_FILTER value
optionally filter by a value: pass|reject|criteria|redacted
-E|--qual-filter Filter used in early 1K Genomes data:
no sequences starting or ending with >= 10N
Filters for individual reads Applied only with --split-spot set
--skip-technical Dump only biological reads
OUTPUT
-O|--outdir <path> Output directory, default is '.'
Multiple File Options Setting this options will produce more than 1 file, which will be suffixed by splitting criteria.
--split-files Dump each read into a separate file.Files will received suffix corresponding to read number
--split-3 Legacy 3-file splitting for mate-pairs:
First 2 biological reads satisfying dumping conditions
are placed in files *_1.fastq and *_2.fastq
If only 1 biological read is dumpable - it is placed in *.fastq
Biological reads 3 and above are ignored.
-G|--spot-group Split into files by SPOT_GROUP (member name)
-R|--read-filter <[filter]> Split into files by READ_FILTER value
optionally filter by a value: pass|reject|criteria|redacted
-T|--group-in-dirs Split into subdirectories instead of files
-K|--keep-empty-files Do not delete empty files
FORMATTING
Sequence
-C|--dumpcs <[cskey]> Formats sequence in color space (default for SOLiD),cskey may be specified for translation
-B|--dumpbase Formats sequence in base sequence (default for other than SOLiD).
Quality
-Q|--offset <integer> Offset to use for quality conversion, default is 33
--fasta Fasta only, no qualities
Defline
-F|--origfmt Defline contains only original sequence name
-I|--readids Append read id after spot id as 'accession.spot.readid' on defline
--helicos Helicos style defline
--defline-seq <fmt> Defline format specification for sequence.
--defline-qual <fmt> Defline format specification for quailty.
<fmt> is string of characters and/or variables. Variables could be are one of:
$ac - accession, $si - spot id, $sn - spot name, $sg - spot group (barcode),
$sl - spot length in bases, $ri - read number, $rn - read name, $rl - read length in bases.
'[]' could be used for an optional output: if all vars in [] yield empty values whole group is not printed.
Empty value is empty string or 0 for numeric variables.
Ex: @$sn[_$rn]/$ri - '_$rn' is omitted if name is empty
OTHER:
-h|--help Output a brief explantion for the program
-V|--version Display the version of the program then quit
-L|--log-level <level> Logging level as number or enum string
One of (fatal|sys|int|err|warn|info) or (0-5)
Current/default is warn
-v|--verbose Increase the verbosity level of the program
Use multiple times for more verbosity
sra_sdk-2.1.7/doc/help/html/fastq-load-help.html 0000644 0012213 0011620 00000003535 11627507276 021166 0 ustar rodarmer trace
fastq-load help
Usage:
fastq-load [options] -r run.xml -e experiment.xml -o output-path
-r|--run-xml path to run.xml describing input files
-e|--experiment path to experiment.xml
-o|--output-path target location
Options:
-i|--input-path input files location, default '.'
-u|--input-unpacked input files are unpacked
-f|--force force target overwrite
-n|--spots-number process only given number of spots from input
-b|--bad-spot-number acceptable number of spot creation errors, default is 50
-p|--bad-spot-percentage acceptable percentage of spots creation errors, default is 5
-x|--expected path to expected.xml
-z|--xml-log produce XML-formatted log file
-s|--intensities [on | off] load intensity data, default is off:
Illumina: signal, intensity, noise;
AB SOLiD: signal(s);
LS454: signal, position (for SFF files ON by default).
-h|--help Output a brief explantion for the program.
-V|--version Display the version of the program then quit.
-L|--log-level <level> Logging level as number or enum string.
One of (fatal|sys|int|err|warn|info) or (0-5)
Current/default is warn
-v|--verbose Increase the verbosity level of the program.
Use multiple times for more verbosity.
sra_sdk-2.1.7/doc/help/html/illumina-dump-help.html 0000644 0012213 0011620 00000004434 11627507276 021707 0 ustar rodarmer trace
illumina-dump help
Usage:
illumina-dump [options] [ -A ] <accession>
illumina-dump [options] <path>
-A|--accession <accession> Replaces accession derived from <path> in filename(s) and deflines
Options:
-O|--outdir <path> Output directory, default is '.'
-N|--minSpotId <rowid> Minimum spot id
-X|--maxSpotId <rowid> Maximum spot id
-G|--spot-group Split into files by SPOT_GROUP (member name)
--spot-groups <[list]> Filter by SPOT_GROUP (member): name[,...]
-R|--read-filter <[filter]> Split into files by READ_FILTER value
optionally filter by a value: pass|reject|criteria|redacted
-T|--group-in-dirs Split into subdirectories instead of files
-K|--keep-empty-files Do not delete empty files
--table <table-name> (New) Table name within SRA format, default is SEQUENCE
-h|--help Output a brief explantion for the program
-V|--version Display the version of the program then quit
-L|--log-level <level> Logging level as number or enum string
One of (fatal|sys|int|err|warn|info) or (0-5)
Current/default is warn
-v|--verbose Increase the verbosity level of the program
Use multiple times for more verbosity
Format options:
-r|--read Output READ: "seq", default is on
-q|--qual1 <1|2> Output QUALITY, whole spot (1) or split by reads (2): "qcal", default is 1
-p|--qual4 Output full QUALITY: "prb", default is off
-i|--intensity Output INTENSITY, if present: "int", default is off
-n|--noise Output NOISE, if present: "nse", default is off
-s|--signal Output SIGNAL, if present: "sig2", default is off
-x|--qseq <1|2> Output QSEQ format: whole spot (1) or split by reads: "qseq", default is off
sra_sdk-2.1.7/doc/help/html/illumina-load-help.html 0000644 0012213 0011620 00000003543 11627507276 021661 0 ustar rodarmer trace
illumina-load help
Usage:
illumina-load [options] -r run.xml -e experiment.xml -o output-path
-r|--run-xml path to run.xml describing input files
-e|--experiment path to experiment.xml
-o|--output-path target location
Options:
-i|--input-path input files location, default '.'
-u|--input-unpacked input files are unpacked
-f|--force force target overwrite
-n|--spots-number process only given number of spots from input
-b|--bad-spot-number acceptable number of spot creation errors, default is 50
-p|--bad-spot-percentage acceptable percentage of spots creation errors, default is 5
-x|--expected path to expected.xml
-z|--xml-log produce XML-formatted log file
-s|--intensities [on | off] load intensity data, default is off:
Illumina: signal, intensity, noise;
AB SOLiD: signal(s);
LS454: signal, position (for SFF files ON by default).
-h|--help Output a brief explantion for the program.
-V|--version Display the version of the program then quit.
-L|--log-level <level> Logging level as number or enum string.
One of (fatal|sys|int|err|warn|info) or (0-5)
Current/default is warn
-v|--verbose Increase the verbosity level of the program.
Use multiple times for more verbosity.
sra_sdk-2.1.7/doc/help/html/kar-help.html 0000644 0012213 0011620 00000005521 11627507276 017705 0 ustar rodarmer trace
kar help
Usage:
kar [OPTIONS] -c|--create <Archive> -d|--directory <Directory> [Filter ...]
kar [OPTIONS] -x|--extract <Archive> -d|--directory <Directory>
kar [OPTIONS] -t|--test|--list <Archive>
Summary:
Create, extract from, or test an archive.
Archive Command:
All of these options require the next token on the command line to be
the name of the archive
-c|--create <archive> Create a new archive.
-x|--extract <archive> Extract the contents of an archive into a directory.
-t|--test <archive> Check the structural validity of an archive
Optionally listing its contents
Archive:
Path to a file that will/does hold the archive of other files
Directory:
Required for create or extract command, ignored for test command
Filters:
When present these act as include filters.
Any file name will be included in the extracted files, created archive
or test operation listing
Any directory will be included as well as its contents
Options:
-d|--directory <Directory> The next token on the command line is the
name of the directory to extract to or create
from
-f|--force (no parameter) this will cause the extract or
create to over-write existing files unless
they are write-protected. without this
option the program will fail if the archive
already exists for a create or the target
directory exists for an extract
-a|--align <alignment> Forces the alignment of files in create
mode putting the first byte of included
files at <alignment boundaries
alignment: 1|2|4|8
(default=4)
-l|--long-list more information will be given on each file
in test/list mode.
-h|--help Output a brief explantion for the program.
-V|--version Display the version of the program then quit.
-L|--log-level <level> Logging level as number or enum string.
One of (fatal|sys|int|err|warn|info) or (0-5)
Current/default is warn
-v|--verbose Increase the verbosity level of the program.
Use multiple times for more verbosity.
sra_sdk-2.1.7/doc/help/html/kdbmeta-help.html 0000644 0012213 0011620 00000003720 11627507276 020536 0 ustar rodarmer trace
kdbmeta help
Usage:
kdbmeta [Options] <target> {<query> ...]
Summary:
Display the contents of one or more metadata stores.
The target metadata are described by one or more
target specifications, giving the path to a database, a table
or a column. the command and query are executed on each target.
queries name one or more objects, and '*' acts as a wildcard.
query objects are nodes or attributes. nodes are named with a
hierarchical path, like a file-system path. attributes are given
as a node path followed by a '@' followed by the attribute name.
target:
path-to-database access database metadata
path-to-table access table metadata
path-to-column access column metadata
accession sra global access id
query:
* all nodes and attributes
NAME a named root node and children
PATH/NAME an internal node and children
<node>@ATTR a named attribute
<obj>=VALUE a simple value assignment where
value string is text, and binary
values use hex escape codes
Options:
-h|--help Output a brief explantion for the program.
-V|--version Display the version of the program then quit.
-L|--log-level <level> Logging level as number or enum string.
One of (fatal|sys|int|err|warn|info) or (0-5)
Current/default is warn
-v|--verbose Increase the verbosity level of the program.
Use multiple times for more verbosity.
sra_sdk-2.1.7/doc/help/html/kqsh-help.html 0000644 0012213 0011620 00000000610 11476747102 020064 0 ustar rodarmer trace
kqsh help
Usage: kqsh [ options ] [ file... ]
options:
-h give tool help
-u enable update operations
-l path(s) for loading dynamic libraries
sra_sdk-2.1.7/doc/help/html/md5cp-help.html 0000644 0012213 0011620 00000001117 11476747102 020131 0 ustar rodarmer trace
md5cp help
usage: md5cp [-p] [-f] [-r] [file|directory ...] directory
md5cp [-f] source_filename dest_filename
: Copies files and/or directories, creating an md5sum checksum (named file.md5) for all copied files.
-f forces replacement of existing files.
-p forces replacement of existing modes on files and directories.
-r recurses over source directories (directories are ignored otherwise)
sra_sdk-2.1.7/doc/help/html/rcexplain-help.html 0000644 0012213 0011620 00000001532 11627507276 021113 0 ustar rodarmer trace
rcexplain help
Usage:
rcexplain [Options] rc [rc ...]
Summary:
Prints out error string to stdout for one or more return codes.
Options:
-h|--help Output a brief explantion for the program.
-V|--version Display the version of the program then quit.
-L|--log-level <level> Logging level as number or enum string.
One of (fatal|sys|int|err|warn|info) or (0-5)
Current/default is warn
-v|--verbose Increase the verbosity level of the program.
Use multiple times for more verbosity.
sra_sdk-2.1.7/doc/help/html/sff-dump-help.html 0000644 0012213 0011620 00000003205 11627507276 020646 0 ustar rodarmer trace
sff-dump help
Usage:
sff-dump [options] [ -A ] <accession>
sff-dump [options] <path>
-A|--accession <accession> Replaces accession derived from <path> in filename(s) and deflines
Options:
-O|--outdir <path> Output directory, default is '.'
-N|--minSpotId <rowid> Minimum spot id
-X|--maxSpotId <rowid> Maximum spot id
-G|--spot-group Split into files by SPOT_GROUP (member name)
--spot-groups <[list]> Filter by SPOT_GROUP (member): name[,...]
-R|--read-filter <[filter]> Split into files by READ_FILTER value
optionally filter by a value: pass|reject|criteria|redacted
-T|--group-in-dirs Split into subdirectories instead of files
-K|--keep-empty-files Do not delete empty files
--table <table-name> (New) Table name within SRA format, default is SEQUENCE
-h|--help Output a brief explantion for the program
-V|--version Display the version of the program then quit
-L|--log-level <level> Logging level as number or enum string
One of (fatal|sys|int|err|warn|info) or (0-5)
Current/default is warn
-v|--verbose Increase the verbosity level of the program
Use multiple times for more verbosity
sra_sdk-2.1.7/doc/help/html/sra-dump-help.html 0000644 0012213 0011620 00000002237 11627507276 020661 0 ustar rodarmer trace
sra-dump help
Usage:
sra-dump [ options ] table [ column-spec ... ]
Summary:
Dump all data in table for specified or all columns
table:
path to table or accession id within NCBI
column-spec:
NAME simple column name
(typedecl)NAME specifically typed column name
Options:
--start <ID> beginning spot id (default 1)
--stop <ID> ending spot id (default max)
-h|--help Output a brief explantion for the program.
-V|--version Display the version of the program then quit.
-L|--log-level <level> Logging level as number or enum string.
One of (fatal|sys|int|err|warn|info) or (0-5)
Current/default is warn
-v|--verbose Increase the verbosity level of the program.
Use multiple times for more verbosity.
sra_sdk-2.1.7/doc/help/html/sra-stat-help.html 0000644 0012213 0011620 00000002265 11627507276 020670 0 ustar rodarmer trace
sra-stat help
Usage:
sra-stat [options] table
Summary:
Display table statistics
Options:
-x|--xml output as XML (default is text)
-b|--start <row-id> starting spot id ( default 1 )
-e|--stop <row-id> ending spot id ( default max )
-m|--meta print load metadata
-q|--quick quick mode: get statistics from metadata
not to scan the table
-h|--help Output a brief explantion for the program.
-V|--version Display the version of the program then quit.
-L|--log-level <level> Logging level as number or enum string.
One of (fatal|sys|int|err|warn|info) or (0-5)
Current/default is warn
-v|--verbose Increase the verbosity level of the program.
Use multiple times for more verbosity.
sra_sdk-2.1.7/doc/help/html/srapath-help.html 0000644 0012213 0011620 00000003340 11476747102 020563 0 ustar rodarmer trace
srapath help
Usage:
srapath 1.2.0
Usage: srapath [ options ] accession ...
options:
--server path(s) to replication server(s)
--volume relative path(s) to volume(s)
Tool to produce a list of full paths to SRA runs from list of
accessions. Output paths are ordered according to accession list.
with no path alteration options, the accession search path will be
determined according to the local installation.
Replication server and volume paths may be compound, adhering to the
Unix path convention of ':' separators, e.g.
'/server1:/server2/subdir'
The idea behind separate replication servers and volumes is to
allow for a matrix of volumes that can hold a run, where the volumes
are expected to be replicated across all repservers. It is possible that
this arrangement will be violated and still work, but behavior is less
clearly defined.
The order of search paths is important: rather than alphabetical,
specify paths in the preferred order of discovery, usually giving the most
recently updated volumes first. If a run appears more than once in the matrix,
it will be found according to the first 'repserver/volume' combination that
produces a hit.
Finally, this tool produces a path that is 'likely' to be a run, in that
an entry exists in the file system at the location predicted. It is possible
that this path will fail to produce success upon opening a run if the path does
not point to a valid object.
sra_sdk-2.1.7/doc/help/html/srf-load-help.html 0000644 0012213 0011620 00000003530 11627507276 020635 0 ustar rodarmer trace
srf-load help
Usage:
srf-load [options] -r run.xml -e experiment.xml -o output-path
-r|--run-xml path to run.xml describing input files
-e|--experiment path to experiment.xml
-o|--output-path target location
Options:
-i|--input-path input files location, default '.'
-u|--input-unpacked input files are unpacked
-f|--force force target overwrite
-n|--spots-number process only given number of spots from input
-b|--bad-spot-number acceptable number of spot creation errors, default is 50
-p|--bad-spot-percentage acceptable percentage of spots creation errors, default is 5
-x|--expected path to expected.xml
-z|--xml-log produce XML-formatted log file
-s|--intensities [on | off] load intensity data, default is off:
Illumina: signal, intensity, noise;
AB SOLiD: signal(s);
LS454: signal, position (for SFF files ON by default).
-h|--help Output a brief explantion for the program.
-V|--version Display the version of the program then quit.
-L|--log-level <level> Logging level as number or enum string.
One of (fatal|sys|int|err|warn|info) or (0-5)
Current/default is warn
-v|--verbose Increase the verbosity level of the program.
Use multiple times for more verbosity.
sra_sdk-2.1.7/doc/help/html/txt2kdb-help.html 0000644 0012213 0011620 00000004137 11476747102 020510 0 ustar rodarmer trace
txt2kdb help
txt2kdb [Options] FILE KCOLUMN
Create a KColumn physical column out of a text file.
FILE:
The text file should be ASCII or UTF-8 using LF, CR or CR-LF
line termination. Each text line will be put into the
KColumn as a separate Row. Each Row will be in its own
blob.
KCOLUMN:
The KColumn is either an existing KColumn or a path to one
that can be created. Both paths should be relative to the current directory or full
from root "/"
Options:
-b, --begin=START include only lines starting from this line in the
KColumn. The first line is line 1 (not 0).
-e, --end=STOP stop including lines after this line in the
KColumn. The first line is line 1 (not 0).
-f, --force (no parameter) this will cause to over-write
existing files. Without
this option the program will fail if the KColumn
already exists and append mode is not selected
-a, --append (no parameter) this will cause to append the text
file to an existing KColumn. If the file does not
already exist it will be created.
-V, --version this will cause the program to emit the internal
version number before any other action
-v, --verbose extra information will be output during
processing second occurrence on the command line
means even more
-h, -?, --help print this message
-l, --log-level=LEVEL the next token will affect the logging level of
the program accepted tokens are the numbers
0-15, fatal, sys, int, err, warn, info
, debug1...debug10
sra_sdk-2.1.7/doc/help/html/vdb-dump-help.html 0000644 0012213 0011620 00000003744 11645077605 020651 0 ustar rodarmer trace
vdb-dump help
Usage:
vdb-dump <path> [options]
Options:
-I|--row_id_on print row id
-l|--line_feed <line_feed> line-feed's inbetween rows
-N|--colname_off do not print column-names
-X|--in_hex print numbers in hex
-T|--table <table> table-name
-R|--rows <rows> rows (default = all)
-C|--columns <columns> columns (default = all)
-S|--schema <schema> schema-name
-A|--schema_dump dumps the schema
-E|--table_enum enumerates tables
-O|--column_enum enumerates columns in extended form
-o|--column_enum_short enumerates columns in short form
-D|--dna_bases <dna_bases> print dna-bases
-M|--max_length <max_length> limits line length
-i|--indent_width <indent_width> indents the line
-f|--format <format> dump format (csv,xml,json,piped,tab)
-r|--id_range prints id-range
-n|--without_sra without sra-type-translation
-a|--without_accession without accession-test
-x|--exclude exclude these columns
-b|--boolean defines how boolean's are printed (1,T)
-h|--help Output a brief explantion for the program.
-V|--version Display the version of the program then quit.
-L|--log-level <level> Logging level as number or enum string.
One of (fatal|sys|int|err|warn|info) or (0-5)
Current/default is warn
-v|--verbose Increase the verbosity level of the program.
Use multiple times for more verbosity.
sra_sdk-2.1.7/doc/help/txt/ 0000755 0012213 0011620 00000000000 11477730356 015164 5 ustar rodarmer trace sra_sdk-2.1.7/doc/help/txt/abi-dump-help.txt 0000644 0012213 0011620 00000001514 11476747102 020346 0 ustar rodarmer trace Usage:
abi-dump
-path
[-outdir ] [-minSpotId ] [-maxSpotId ]
[-minReadLen ] [-noclip] [-origfmt] [-noDotReads]
Where:
-accession Run accession - top level directory for SRA format either downloaded or locally generated
-path Path to (but not including) accession
-outdir Output directory (defaults to current directory)
-minSpotId Minimum spot id to output
-maxSpotId Maximum spot id to output
-minReadLen Minimum read length to output (defaults is 25)
-noclip Indicates don't apply clip quality right
-origfmt Excludes SRR accession & length on defline
-noDotReads No reads consisting only of dots are output
-noSignal Do not write sginal files
sra_sdk-2.1.7/doc/help/txt/abi-load-help.txt 0000644 0012213 0011620 00000003104 11476747102 020315 0 ustar rodarmer trace Usage:
abi-load
abi-load [ ] [ ]
input-spec:
( -r | --run-xml ) path # path to run.xml describing input files
spot-descriptor:
( -e | --experiment ) path # path to experiment.xml
# with spot descriptor
output-spec:
# produce output to run
output-mode:
-c | --create # create only new run (fail if exists)
-o | --output # create new or replace existing run
-a | --append # create new or update existing run
run-name:
path # full or working-directory relative
# file-system path to run
options:
( -n | --spotnumber) spots_to_run # tells the loader to stop processing after that many spots
# helpful in testing
( -b | --bad-spot-number ) bad_spot_number # number of spot creation errors to be tolerated
# default = 50
( -p | --bad-spot-percentage ) bad_spot_percentage> # PERCENTAGE of the number of bad spots against
# the number of good spots, default = 5
help:
( -h | --help ) # print usage and option details
verbosity:
( -l | --log-level ) #logging level: fatal|sys|int|err|warn|info default=info
debug:
( -+ | --debug ) #module: APP|KFS|XML|VDB|SRA|REF|LEGREF default=APP
sra_sdk-2.1.7/doc/help/txt/bam-loader-help.txt 0000644 0012213 0011620 00000001451 11476747102 020653 0 ustar rodarmer trace Usage:
bam-loader 0.0.1
bam-loader [Options] BAMFILE
Load a bam file.
Options:
-o, --output=TABLEPATH REQUIRED: path to a table where the table will be put
-V, --version this will cause the program to emit the internal
version number before any other action
-v, --verbose extra information will be output during
processing second occurrence on the command line
means even more
-h, -?, --help print this message
-l, --log-level=LEVEL the next token will affect the logging level of
the program accepted tokens are the numbers
0-15, fatal, sys, int, err, warn, info
, debug1...debug10
sra_sdk-2.1.7/doc/help/txt/copycat-help.txt 0000644 0012213 0011620 00000004417 11476747102 020317 0 ustar rodarmer trace
copycat : 1.0.6
Usage:
copycat [ ] src-file dst-file
copycat [ ] src-file [src-file...] dst-dir
copycat [ ] -o dst-dir src-file [src-file...]
options:
-x cache-dir location to output cached files
-f force overwrite of existing files
-m magicfile path to the magic file to use
-e extfile path to the extensions file to use
-c classfile path to the file class/type file
behavior is intended to mimic 'cp' to a large extent, in that
a single source file may be copied to a new name, or multiple
source files may be copied to a destination directory.
when the destination directory is specified using 'cp' semantics,
the directory must exist. if specified via '-o' switch, it will be
created if necessary.
the target file may also be a device. in the special case of
/dev/null, it may also act as a directory.
the '-x' option allows small files that are typed as eligible for
caching to be copied to the cache directory provided. the directory
will be created if necessary.
the intent is to capture top-level files, such that files are copied
into the flat cache directory without regard to where they were found
in the input hierarchy. in the case of name conflict, output files will
be renamed.
the class file, magic file and extension file allow new understandings
of files found while cataloging
the magic file is of the type used by the unix/linux 'file' command
the class file assigns file type to classes
the extension file assigns file extensions to file types
existing classes are 'Archive', 'Cached', 'Compressed', 'Read'
Archive and Compresses files are those that have contents that can
be examined - new types must be compiled in
Cached files are those affected by the -x option
Read files are not handled seperately by copy cat except in the catalog
new classes would like Read only be added to the catalog with the class
the format for the class file is lines such as the below
'GnuZipCompressed' with tabs and linefeeds
the format for the extension file is lines such as the below
'gzCompressed' with tabs and linefeeds
sra_sdk-2.1.7/doc/help/txt/crc32sum-help.txt 0000644 0012213 0011620 00000000227 11476747102 020311 0 ustar rodarmer trace : usage: crc32sum [] file [file...]
options:
-c check CRC32 against given list
-b open file in binary mode
sra_sdk-2.1.7/doc/help/txt/fastq-dump-help.txt 0000755 0012213 0011620 00000005471 11476747102 020742 0 ustar rodarmer trace
Usage:
fastq-dump [options]
Options:
-D, --table-path Path to accession data.
-O, --outdir Output directory. Default: '.'
-N, --minSpotId Minimum spot id to output.
-X, --maxSpotId Maximum spot id to output.
-G, --spot-group Split into files by SPOT_GROUP (member).
-T, --group-in-dirs Split into subdirectories instead of files.
-K, --keep-empty-files Do not delete empty files.
-L, --log-level Logging level: fatal|sys|int|err|warn|info.
[default: info]
-+, --debug one of APP|KFS|XML|VDB|SRA|REF|LEGREF.
[default: APP]
-H, --help Prints this message.
Format options:
-M, --minReadLen Minimum read length to output.
[default: 25]
-W, --noclip Do not clip quality right for spot.
-F, --origfmt Excludes SRR accession & length on defline.
-C, --dumpcs [] Dump color space sequence.
[enabled by default for ABI SOLID]
[single letter color space key is optional]
-B, --dumpbase Dump base sequence.
[enabled by default for other than ABI SOLID]
-Q, --offset Offset to use for quality conversion.
[default: 33]
-I, --readids Append read id after spot id as
'..' on defline.
-E, --no-qual-filter Disable filtering by leading/trailng low quality.
-SF, --complete Dump ALL reads in a single file.
-DB, --defline-seq Sequence defline format specification;
string of characters and/or variables.
-DQ, --defline-qual quailty defline format specification.
If -DB is provided but -DQ ommitted,
-DB value is used.
-alt [n] alternative formatting version [1].
Defline substitution variables:
'$ac' accession
'$si' spot id
'$sn' spot name
'$sg' spot group (member/barcode)
'$sl' spot length in bases
'$ri' read id
'$rn' read name
'$rl' read length in bases.
Substitution variables begin with a '$' character followed by a two
character symbol, e.g. 'ac'. '[]' could be used for an optional output:
if all variables in [] yield empty values whole group is not printed.
Empty value is empty string or 0 for numeric variables.
Ex: @$sn[_$rn]/$ri - '_$rn' is omitted if name is empty
sra_sdk-2.1.7/doc/help/txt/fastq-load-help.txt 0000644 0012213 0011620 00000003110 11476747102 020675 0 ustar rodarmer trace Usage:
fastq-load
fastq-load [ ] [ ]
input-spec:
( -r | --run-xml ) path # path to run.xml describing input files
spot-descriptor:
( -e | --experiment ) path # path to experiment.xml
# with spot descriptor
output-spec:
# produce output to run
output-mode:
-c | --create # create only new run (fail if exists)
-o | --output # create new or replace existing run
-a | --append # create new or update existing run
run-name:
path # full or working-directory relative
# file-system path to run
options:
( -n | --spotnumber) spots_to_run # tells the loader to stop processing after that many spots
# helpful in testing
( -b | --bad-spot-number ) bad_spot_number # number of spot creation errors to be tolerated
# default = 50
( -p | --bad-spot-percentage ) bad_spot_percentage> # PERCENTAGE of the number of bad spots against
# the number of good spots, default = 5
help:
( -h | --help ) # print usage and option details
verbosity:
( -l | --log-level ) #logging level: fatal|sys|int|err|warn|info default=info
debug:
( -+ | --debug ) #module: APP|KFS|XML|VDB|SRA|REF|LEGREF default=APP
sra_sdk-2.1.7/doc/help/txt/illumina-dump-help.txt 0000644 0012213 0011620 00000002465 11476747102 021433 0 ustar rodarmer trace
Usage:
illumina-dump [options] [ -A ]
illumina-dump [options]
-A, --accession Accession.
Options:
-D, --table-path Path to accession data.
-O, --outdir Output directory. Default: '.'
-N, --minSpotId Minimum spot id to output.
-X, --maxSpotId Maximum spot id to output.
-G, --spot-group Split into files by SPOT_GROUP (member).
-T, --group-in-dirs Split into subdirectories instead of files.
-K, --keep-empty-files Do not delete empty files.
-L, --log-level Logging level: fatal|sys|int|err|warn|info. Default: info
-+, --debug debug: APP|KFS|XML|VDB|SRA|REF|LEGREF. Default: APP
-H, --help Prints this message.
Format options:
-r, --read Output READ: "seq". Default: on
-q, --qual1 Output QUALITY, into single (1) or multiple (2) files: "qcal". Default: 1
-p, --qual4 Output full QUALITY: "prb". Default: off
-i, --intensity Output INTENSITY, if present: "int". Default: off
-n, --noise Output NOISE, if present: "nse". Default: off
-s, --signal Output SIGNAL, if present: "sig2". Default: off
-qseq Output QSEQ format: "qseq". Default: off
sra_sdk-2.1.7/doc/help/txt/illumina-load-help.txt 0000644 0012213 0011620 00000003116 11476747102 021377 0 ustar rodarmer trace Usage:
illumina-load
illumina-load [ ] [ ]
input-spec:
( -r | --run-xml ) path # path to run.xml describing input files
spot-descriptor:
( -e | --experiment ) path # path to experiment.xml
# with spot descriptor
output-spec:
# produce output to run
output-mode:
-c | --create # create only new run (fail if exists)
-o | --output # create new or replace existing run
-a | --append # create new or update existing run
run-name:
path # full or working-directory relative
# file-system path to run
options:
( -n | --spotnumber) spots_to_run # tells the loader to stop processing after that many spots
# helpful in testing
( -b | --bad-spot-number ) bad_spot_number # number of spot creation errors to be tolerated
# default = 50
( -p | --bad-spot-percentage ) bad_spot_percentage> # PERCENTAGE of the number of bad spots against
# the number of good spots, default = 5
help:
( -h | --help ) # print usage and option details
verbosity:
( -l | --log-level ) #logging level: fatal|sys|int|err|warn|info default=info
debug:
( -+ | --debug ) #module: APP|KFS|XML|VDB|SRA|REF|LEGREF default=APP
sra_sdk-2.1.7/doc/help/txt/kar-help.txt 0000644 0012213 0011620 00000004673 11476747102 017436 0 ustar rodarmer trace kar : 1.0.1
Usage: kar [options] [Archive Command] [Directory] [optional filters]
Create an NCBI archive from a directory
or
Test (list the contents) of an NCBI archive
or
Extract the contents of an NCBI archive into a directory
Archive Command:
All of these options require the next token on the command line to be
the name of the archive
-c, --create=ARCHIVE create a new archive
-t, --test=ARCHIVE check the structural validity of an archive
optionally listing its contents
-x, --extract=ARCHIVE extract the contents of an archive into a
directory
Directory:
Required for create or extract command, ignored for test command
-d, --directory=DIRECTORY the next token on the command line is the name
of the directory to extract to or create from
Optional filters:
When present these act as include filters.
Any file name will be included in the extracted files, created archive
or test operation listing
Any directory will be included as well as its contents
Options:
-f, --force (no parameter) this will cause the extract or
create to over-write existing files unless they
are write-protected. without this option the program
will fail if the archive already exists for a create or
the target directory exists for an extract
-a, --alignment=ALIGN 1,2,4,8 Forces the alignment of files in create
mode putting the first byte of included files
at ALIGN boundaries (default=4)
-V, --version this will cause the program to emit the internal
version number before any other action
-v, --verbose extra information will be output during
processinga second occurance on the command line
means even more
-L, --long-list more information will be given on each file in
test/list mode
-h, -?, --help print this message
-l, --log-level=LEVEL the next token will affect the logging level of
the program accepted tokens are the numbers
0-15, fatal, sys, int, err, warn, info
and debug1...debug10
sra_sdk-2.1.7/doc/help/txt/kdbmeta-help.txt 0000644 0012213 0011620 00000002405 11476747102 020257 0 ustar rodarmer trace Usage:kdbmeta [ ... ]
cmd:
select display contents
target: one of
path-to-database access database metadata
path-to-table access table metadata
path-to-column access column metadata
accession sra global access id
query:
* all nodes and attributes
NAME a named root node and children
PATH/NAME an internal node and children
@ATTR a named attribute
=VALUE a simple value assignment where
value string is text, and binary
values use hex escape codes
tool to display or modify contents of one or more metadata
stores. the target metadata are described by one or more
target specifications, giving the path to a database, a table
or a column. the command and query are executed on each target.
queries name one or more objects, and '*' acts as a wildcard.
query objects are nodes or attributes. nodes are named with a
hierarchical path, like a file-system path. attributes are given
as a node path followed by a '@' followed by the attribute name.
sra_sdk-2.1.7/doc/help/txt/kqsh-help.txt 0000644 0012213 0011620 00000000306 11476747102 017614 0 ustar rodarmer trace Usage: kqsh [ options ] [ file... ]
options:
-h give tool help
-u enable update operations
-l path(s) for loading dynamic libraries
sra_sdk-2.1.7/doc/help/txt/md5cp-help.txt 0000644 0012213 0011620 00000000613 11476747102 017657 0 ustar rodarmer trace usage: md5cp [-p] [-f] [-r] [file|directory ...] directory
md5cp [-f] source_filename dest_filename
: Copies files and/or directories, creating an md5sum checksum (named file.md5) for all copied files.
-f forces replacement of existing files.
-p forces replacement of existing modes on files and directories.
-r recurses over source directories (directories are ignored otherwise)
sra_sdk-2.1.7/doc/help/txt/rcexplain-help.txt 0000644 0012213 0011620 00000000144 11476747102 020633 0 ustar rodarmer trace
Usage: rcexplain rc [ rc... ]
prints out error string to stdout for one or more return codes
sra_sdk-2.1.7/doc/help/txt/sff-dump-help.txt 0000644 0012213 0011620 00000001402 11476747102 020365 0 ustar rodarmer trace
Usage:
sff-dump [options] [ -A ]
sff-dump [options]
-A, --accession Accession.
Options:
-D, --table-path Path to accession data.
-O, --outdir Output directory. Default: '.'
-N, --minSpotId Minimum spot id to output.
-X, --maxSpotId Maximum spot id to output.
-G, --spot-group Split into files by SPOT_GROUP (member).
-T, --group-in-dirs Split into subdirectories instead of files.
-K, --keep-empty-files Do not delete empty files.
-L, --log-level Logging level: fatal|sys|int|err|warn|info. Default: info
-+, --debug debug: APP|KFS|XML|VDB|SRA|REF|LEGREF. Default: APP
-H, --help Prints this message.
sra_sdk-2.1.7/doc/help/txt/sra-dump-help.txt 0000644 0012213 0011620 00000000724 11476747102 020402 0 ustar rodarmer trace
Usage: sra-dump [ options ] table [ column-spec ... ]
dump all column data.
options:
-h give tool help
--help
--start ID starting spot id ( default 1 )
--stop ID ending spot id ( default max )
-l, --level Log level: 0-5 or one of
column-spec:
NAME simple column name
(typedecl)NAME specifically typed column name
sra_sdk-2.1.7/doc/help/txt/sra-stat-help.txt 0000644 0012213 0011620 00000001207 11476747102 020405 0 ustar rodarmer trace
Usage: sra-stat [ options ] table [ column-spec ... ]
display column statistics.
options:
-h give tool help
--help
--xml output in XML (default is ASCII)
--start ID starting spot id ( default 1 )
--stop ID ending spot id ( default max )
-l, --level Log level: 0-5 or one of
fatal | sys | int | err | warn | info ( default warn )
column-spec:
NAME simple column name
(typedecl)NAME specifically typed column name
sra_sdk-2.1.7/doc/help/txt/srapath-help.txt 0000644 0012213 0011620 00000003033 11476747102 020310 0 ustar rodarmer trace Usage:
srapath 1.2.0
Usage: srapath [ options ] accession ...
options:
--server path(s) to replication server(s)
--volume relative path(s) to volume(s)
Tool to produce a list of full paths to SRA runs from list of
accessions. Output paths are ordered according to accession list.
with no path alteration options, the accession search path will be
determined according to the local installation.
Replication server and volume paths may be compound, adhering to the
Unix path convention of ':' separators, e.g.
'/server1:/server2/subdir'
The idea behind separate replication servers and volumes is to
allow for a matrix of volumes that can hold a run, where the volumes
are expected to be replicated across all repservers. It is possible that
this arrangement will be violated and still work, but behavior is less
clearly defined.
The order of search paths is important: rather than alphabetical,
specify paths in the preferred order of discovery, usually giving the most
recently updated volumes first. If a run appears more than once in the matrix,
it will be found according to the first 'repserver/volume' combination that
produces a hit.
Finally, this tool produces a path that is 'likely' to be a run, in that
an entry exists in the file system at the location predicted. It is possible
that this path will fail to produce success upon opening a run if the path does
not point to a valid object.
sra_sdk-2.1.7/doc/help/txt/srf-load-help.txt 0000644 0012213 0011620 00000003104 11476747102 020354 0 ustar rodarmer trace Usage:
srf-load
srf-load [ ] [ ]
input-spec:
( -r | --run-xml ) path # path to run.xml describing input files
spot-descriptor:
( -e | --experiment ) path # path to experiment.xml
# with spot descriptor
output-spec:
# produce output to run
output-mode:
-c | --create # create only new run (fail if exists)
-o | --output # create new or replace existing run
-a | --append # create new or update existing run
run-name:
path # full or working-directory relative
# file-system path to run
options:
( -n | --spotnumber) spots_to_run # tells the loader to stop processing after that many spots
# helpful in testing
( -b | --bad-spot-number ) bad_spot_number # number of spot creation errors to be tolerated
# default = 50
( -p | --bad-spot-percentage ) bad_spot_percentage> # PERCENTAGE of the number of bad spots against
# the number of good spots, default = 5
help:
( -h | --help ) # print usage and option details
verbosity:
( -l | --log-level ) #logging level: fatal|sys|int|err|warn|info default=info
debug:
( -+ | --debug ) #module: APP|KFS|XML|VDB|SRA|REF|LEGREF default=APP
sra_sdk-2.1.7/doc/help/txt/txt2kdb-help.txt 0000644 0012213 0011620 00000003632 11476747102 020235 0 ustar rodarmer trace
txt2kdb [Options] FILE KCOLUMN
Create a KColumn physical column out of a text file.
FILE:
The text file should be ASCII or UTF-8 using LF, CR or CR-LF
line termination. Each text line will be put into the
KColumn as a separate Row. Each Row will be in its own
blob.
KCOLUMN:
The KColumn is either an existing KColumn or a path to one
that can be created. Both paths should be relative to the current directory or full
from root "/"
Options:
-b, --begin=START include only lines starting from this line in the
KColumn. The first line is line 1 (not 0).
-e, --end=STOP stop including lines after this line in the
KColumn. The first line is line 1 (not 0).
-f, --force (no parameter) this will cause to over-write
existing files. Without
this option the program will fail if the KColumn
already exists and append mode is not selected
-a, --append (no parameter) this will cause to append the text
file to an existing KColumn. If the file does not
already exist it will be created.
-V, --version this will cause the program to emit the internal
version number before any other action
-v, --verbose extra information will be output during
processing second occurrence on the command line
means even more
-h, -?, --help print this message
-l, --log-level=LEVEL the next token will affect the logging level of
the program accepted tokens are the numbers
0-15, fatal, sys, int, err, warn, info
, debug1...debug10
sra_sdk-2.1.7/doc/help/txt/vdb-dump-help.txt 0000644 0012213 0011620 00000003335 11476747102 020371 0 ustar rodarmer trace **************************************************************
vdb-dump:
**************************************************************
usage:
vdb-dump database-path -Ttable -Rrows -Ccolumns [options]
table.......Tab1 or omit for first table in database
rows........1-100,200,205,300-305 or omit for all rows
columns.....COL1,COL2,COL3 or omit for all available columns
example: vdb-dump mydb -TTab1 -R1-200 -CLINE,ID
**************************************************************
options:
--table -T ... specify the table-name (mandatory)
--rows -R ... specify the row-range (default all)
--columns -C ... specify the columns (default all)
--schema -S ... specify a schema to use (default none)
--help -h -? ... show help
--row_id_on -I ... print row id (default off)
--line_feed -l ... line-feed's inbetween rows (default 1)
--colname_off -N ... print column-names (default on)
--in_hex -X ... prints valuex in hex (default decimal)
--schema_dump -A ... dumps the schema instead of the data
--table_enum -E ... list the found tables in the database
--version -V ... show manager-version before dumping
--column_enum -O ... list the columns of the specified table
--dna_bases -D ... print DNA-bases (if column-type fits)
--max_length -M ... limits the lenght of a line (default no limit)
--indent_width -i ... indents the line (default no indentation)
--filter -F ... prints only lines which fit the filter-expr.
--format -f ... uses default/csv/xml/json
--id_range -r ... prints the id-range of the table
--without_sra -n ... does not translate SRA-types
--no_accession -a ... do not check accession
**************************************************************
sra_sdk-2.1.7/interfaces/ 0000775 0012213 0011620 00000000000 11625746034 014770 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/align/ 0000755 0012213 0011620 00000000000 11645100507 016047 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/align/align-access.h 0000644 0012213 0011620 00000024304 11576721672 020573 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_align_align_access_
#define _h_align_align_access_
#ifndef _h_align_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct KPath;
/*--------------------------------------------------------------------------
* constants
*/
typedef uint8_t AlignmentStrandDirection;
enum
{
asd_Unknown, /* e.g. an error occured */
asd_Forward = 'F',
asd_Reverse = 'R'
};
/*--------------------------------------------------------------------------
* AlignAccessMgr
* opaque handle to library
*/
typedef struct AlignAccessMgr AlignAccessMgr;
/* Make
* make a manager for read-only access
*/
ALIGN_EXTERN rc_t CC AlignAccessMgrMake ( const AlignAccessMgr **mgr );
/* AddRef
* Release
*/
ALIGN_EXTERN rc_t CC AlignAccessMgrAddRef ( const AlignAccessMgr *self );
ALIGN_EXTERN rc_t CC AlignAccessMgrRelease ( const AlignAccessMgr *self );
/*--------------------------------------------------------------------------
* AlignAccessDB
* opaque handle to database
*/
typedef struct AlignAccessDB AlignAccessDB;
/* Make
* make a read-only database handle from BAM file
* where the BAM file is treated as the entire database
*
* "bam" [ IN ] - NUL terminated POSIX path in UTF-8 character set
* designating BAM file
*
* "bam_index" [ IN ] - NUL terminated POSIX path in UTF-8 character
* set designating BAM index file
*
* NB - on Windows, these paths should be converted POSIX-style
*/
ALIGN_EXTERN rc_t CC AlignAccessMgrMakeBAMDB ( const AlignAccessMgr *self,
const AlignAccessDB **db, struct KPath const *bam );
ALIGN_EXTERN rc_t CC AlignAccessMgrMakeIndexBAMDB ( const AlignAccessMgr *self,
const AlignAccessDB **db, struct KPath const *bam, struct KPath const *bam_index );
/* AddRef
* Release
*/
ALIGN_EXTERN rc_t CC AlignAccessDBAddRef ( const AlignAccessDB *self );
ALIGN_EXTERN rc_t CC AlignAccessDBRelease ( const AlignAccessDB *self );
/*--------------------------------------------------------------------------
* AlignAccessRefSeqEnumerator
* an enumerator onto available reference sequences
*/
typedef struct AlignAccessRefSeqEnumerator AlignAccessRefSeqEnumerator;
/* EnumerateRefSequences
* make an enumerator of reference sequences visible in database
*
* "refseq_enum" [ OUT ] - return parameter for enumerator
*/
ALIGN_EXTERN rc_t CC AlignAccessDBEnumerateRefSequences ( const AlignAccessDB *self,
AlignAccessRefSeqEnumerator **refseq_enum );
/* AddRef
* Release
*/
ALIGN_EXTERN rc_t CC AlignAccessRefSeqEnumeratorAddRef ( const AlignAccessRefSeqEnumerator *self );
ALIGN_EXTERN rc_t CC AlignAccessRefSeqEnumeratorRelease ( const AlignAccessRefSeqEnumerator *self );
/* advance the enumerator to the next element */
ALIGN_EXTERN rc_t CC AlignAccessRefSeqEnumeratorNext(const AlignAccessRefSeqEnumerator *cself);
/* GetID
* get text id of reference sequence
*
* "id_buffer" [ IN ] and "buffer_size" [ IN ] - return buffer for
* NUL terminated ASCII id
*
* "id_size" [ OUT, NULL OKAY ] - optional return parameter for length
*/
ALIGN_EXTERN rc_t CC AlignAccessRefSeqEnumeratorGetID ( const AlignAccessRefSeqEnumerator *self,
char *id_buffer, size_t buffer_size, size_t *id_size );
/* GetLength
* get text id of reference sequence
*/
ALIGN_EXTERN rc_t CC AlignAccessRefSeqEnumeratorGetLength
( const AlignAccessRefSeqEnumerator *self, uint64_t *length );
/*--------------------------------------------------------------------------
* AlignAccessAlignmentEnumerator
* an enumerator onto alignments
*/
typedef struct AlignAccessAlignmentEnumerator AlignAccessAlignmentEnumerator;
/* EnumerateAlignments
* make an enumerator of all alignments in database
*
* "align_enum" [ OUT ] - return parameter for enumerator
*
* NB - this is a BAD interface, here only to support dumping a BAM file
* it may not be available under all circumstances
*/
ALIGN_EXTERN rc_t CC AlignAccessDBEnumerateAlignments ( const AlignAccessDB *self,
AlignAccessAlignmentEnumerator **align_enum );
/* WindowedAlignments
* make an enumerator of alignments within a window of a reference sequence
*
* "align_enum" [ OUT ] - return parameter for enumerator
*
* "refseq_id" [ IN ] - NUL terminated ASCII string giving reference sequence id
*
* "pos" [ IN ] and "wsize" [ IN ] - starting position and size of window
* on reference sequence
*/
ALIGN_EXTERN rc_t CC AlignAccessDBWindowedAlignments ( const AlignAccessDB *self,
AlignAccessAlignmentEnumerator **align_enum, const char *refseq_id,
uint64_t pos, uint64_t wsize );
/* AddRef
* Release
*/
ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorAddRef ( const AlignAccessAlignmentEnumerator *self );
ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorRelease ( const AlignAccessAlignmentEnumerator *self );
/* Next
* advance the enumerator to the next element
*/
ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorNext ( const AlignAccessAlignmentEnumerator *self );
/* GetRefSeqID
* return id of reference sequence
*
* "id_buffer" [ IN ] and "buffer_size" [ IN ] - return buffer for
* NUL terminated ASCII id
*
* "id_size" [ OUT, NULL OKAY ] - optional return parameter for length
*/
ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetRefSeqID ( const AlignAccessAlignmentEnumerator *self,
char *id_buffer, size_t buffer_size, size_t *id_size );
/* GetRefSeqPos
* return starting position of alignment on reference sequence
*
* "start_pos" [ OUT ] - return parameter for starting position
*/
ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetRefSeqPos ( const AlignAccessAlignmentEnumerator *self,
uint64_t *start_pos );
/* GetShortSeqID
* return accession id of aligned short sequence
*
* "id_buffer" [ IN ] and "buffer_size" [ IN ] - return buffer for
* NUL terminated ASCII id
*
* "id_size" [ OUT, NULL OKAY ] - optional return parameter for length
*/
ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetShortSeqAccessionID
( const AlignAccessAlignmentEnumerator *self, char *id_buffer, size_t buffer_size, size_t *id_size );
/* GetShortSeqID
* return id of aligned short sequence
*
* "id_buffer" [ IN ] and "buffer_size" [ IN ] - return buffer for
* NUL terminated ASCII id
*
* "id_size" [ OUT, NULL OKAY ] - optional return parameter for length
*/
ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetShortSeqID
( const AlignAccessAlignmentEnumerator *self, char *id_buffer, size_t buffer_size, size_t *id_size );
/* GetMapQuality
* return sequence alignment mapping quality score
*
* "score" [ OUT ] - return parameter for mapping quality score (phred-like)
*/
ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetMapQuality ( const AlignAccessAlignmentEnumerator *self,
uint8_t *score );
/* GetCIGAR
* return sequence alignment information
*
* "start_pos" [ OUT, NULL OKAY ] - return parameter for starting position
*
* "cigar_buffer" [ IN, NULL OKAY ] and "buffer_size" [ IN ] - return buffer for CIGAR NUL-terminated
* alignment description; null okay if cigar_size not null
*
* "cigar_size" [ OUT, NULL OKAY ] - optional return parameter for CIGAR string length; null ok
* if cigar_buffer not null
*/
ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetCIGAR ( const AlignAccessAlignmentEnumerator *self,
uint64_t *start_pos, char *cigar_buffer, size_t buffer_size, size_t *cigar_size );
/* GetShortSequence
* return short sequence
*
* "seq_buffer" [ IN ] and "buffer_size" [ IN ] - return buffer for short sequence
*
* "seq_size" [ OUT ] - return parameter for sequence length
*
* NB - BAM states that the sequence will be bases in FASTA.
* we will be extending this interface to provide type information
*/
ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetShortSequence ( const AlignAccessAlignmentEnumerator *self,
char *seq_buffer, size_t buffer_size, size_t *seq_size );
/* GetStrandDirection
* returns property
*/
ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetStrandDirection
( const AlignAccessAlignmentEnumerator *self, AlignmentStrandDirection *result );
/* GetIsPaired
* returns paired property
*/
ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetIsPaired
( const AlignAccessAlignmentEnumerator *self, bool *result );
/* GetIsFirstInPair
* get property
*/
ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetIsFirstInPair
( const AlignAccessAlignmentEnumerator *self, bool *result );
/* GetIsSecondInPair
* get property
*/
ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetIsSecondInPair
( const AlignAccessAlignmentEnumerator *self, bool *result );
/* GetRecordID
* get property
*
* A locally unique identifier for each record. When enumerators from the same
* AlignAccessDB object fetch the same record, they will return the same ID.
*/
ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetRecordID
( const AlignAccessAlignmentEnumerator *self, uint64_t *result );
#ifdef __cplusplus
}
#endif
#endif /* _h_align_align_access_ */
sra_sdk-2.1.7/interfaces/align/align.vschema 0000644 0012213 0011620 00000117246 11645077605 020540 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
/*==========================================================================
* VDB Alignment types, functions and tables
*/
version 1;
include 'vdb/vdb.vschema';
include 'ncbi/seq.vschema';
include 'ncbi/sra.vschema';
include 'ncbi/stats.vschema';
include 'align/seq.vschema';
include 'align/qstat.vschema';
/*--------------------------------------------------------------------------
* data types
*/
/* ploidy
* the number of sets of chromosomes in a cell
*/
typedef U32 NCBI:align:ploidy;
/*--------------------------------------------------------------------------
* functions
*/
/* cigar
* construct "cigar" alignment string
*
* "ctype" [ CONST ] - select variant of format
* 0 => both matches and mismatches represented as M
* 1 => matches represented as '=' mismatches as 'X'
*
* "has_mismatch" [ DATA ] - a boolean for each base in aligned sequence
* where a value of false means the base aligned to the reference
*
* "has_ref_offset" [ DATA ] - a boolean for each base in the aligned sequence
* where a value of true means there is a corresponding offset to position on reference
*
* "ref_offset" [ DATA ] - a packed sequence of signed offsets to aligned position
* one entry for every true in "has_ref_offset"
*/
extern function
ascii NCBI:align:cigar #1 < U8 ctype > ( bool has_mismatch, bool has_ref_offset, I32 ref_offset )
= ALIGN:cigar;
extern function U32 NCBI:align:edit_distance #1 ( bool has_mismatch, bool has_ref_offset, I32 ref_offset );
/* project_from_sequence
* projects column from SEQUENCE
*
* "T" [ TYPE ]
*
* "col" [ CONST ]
* "use_read_len" [ CONST ] whether subset by read_len or by read_id only
*
* "seq_spot_id" [ DATA ]
*
* "seq_read_id" [ DATA ]
*/
extern function < type T >
T NCBI:align:project_from_sequence #1 < ascii col> ( I64 seq_spot_id, INSDC:coord:one seq_read_id )
= ALIGN:project_from_sequence;
/* align_restore_read
* restores read by applying alignment-based difference to ref_read
*
* "ref_read" [ DATA ]
*
* "has_mismatch" [ DATA ] and "mismatch" [ DATA ]
*
* "has_ref_offset" [ DATA ] and "ref_offset" [ DATA ]
*/
extern function
INSDC:4na:bin NCBI:align:align_restore_read #1 ( INSDC:4na:bin ref_read, bool has_mismatch,
INSDC:4na:bin mismatch, bool has_ref_offset, I32 ref_offset)
= ALIGN:align_restore_read;
/* raw_restore_read
* restores read by applying alignment-based difference to align_read
*
* "align_read" [ DATA ]
*
* "ref_orientation" [ DATA ]
*/
extern function
INSDC:4na:bin NCBI:align:raw_restore_read #1 ( INSDC:4na:bin align_read, bool ref_orientation )
= ALIGN:raw_restore_read;
/* raw_restore_qual
* restores quality by applying alignment-based difference to align_qual
*
* "align_qual" [ DATA ]
*
* "ref_orientation" [ DATA ]
*/
extern function
INSDC:quality:phred NCBI:align:raw_restore_qual #1 ( INSDC:quality:phred align_qual, bool ref_orientation );
/* ref_sub_select
* projects reference from sequence
*
* "id" [ DATA ]
*
* "start" [ DATA ] and "len" [ DATA ]
*
* "ref_ploidy" [ DATA, OPTIONAL ]
*/
extern function
INSDC:4na:bin NCBI:align:ref_sub_select #1 ( I64 id, INSDC:coord:zero start,
INSDC:coord:len len * U32 ref_ploidy)
= ALIGN:ref_sub_select;
/* ref_sub_select_preserve_qual
* projects from reference
*
* "id" [ DATA ]
*
* "start" [ DATA ] and "len" [ DATA ]
*
* "ref_ploidy" [ DATA, OPTIONAL ]
*/
extern function
bool NCBI:align:ref_sub_select_preserve_qual #1 ( I64 id, INSDC:coord:zero start,
INSDC:coord:len len * U32 ref_ploidy);
/* ref_restore_read
* restores read from central storage
*
* "cmp_rd" [ DATA ]
*
* "seq_id" [ DATA ]
*
* "seq_start" [ DATA ] and "seq_len" [ DATA ]
*/
extern function
INSDC:4na:bin NCBI:align:ref_restore_read #1 ( INSDC:4na:bin cmp_rd, ascii seq_id,
INSDC:coord:one seq_start, INSDC:coord:len seq_len)
= ALIGN:ref_restore_read;
/* seq_restore_read
* projects read from align_deflate table to SEQUENCE
*
* "cmp_rd" [ DATA ]
*
* "align_id" [ DATA ]
*
* "read_len" [ DATA ]
*
* "rd_type" [ DATA ]
*/
extern function
INSDC:4na:bin NCBI:align:seq_restore_read #1 ( INSDC:4na:bin cmp_rd, I64 align_id,
INSDC:coord:len read_len, INSDC:SRA:xread_type rd_type )
= ALIGN:seq_restore_read;
/* generate_has_mismatch
* generates has mismatch by doing actual compare of reference and subject,
* *ref_offsets move comparisons reference-wise
*
* "reference" [ DATA ]
*
* "subject" [ DATA ]
*
* "has_ref_offset" [ DATA ]
*
* "ref_offset" [ DATA ]
*/
extern function
bool NCBI:align:generate_has_mismatch #1 ( INSDC:4na:bin reference,
INSDC:4na:bin subject, bool has_ref_offset, I32 ref_offset)
= ALIGN:generate_has_mismatch;
/* generate_mismatch
*
* "reference" [ DATA ]
*
* "subject" [ DATA ]
*
* "has_ref_offset" [ DATA ]
*
* "ref_offset" [ DATA ]
*/
extern function
INSDC:4na:bin NCBI:align:generate_mismatch #1 ( INSDC:4na:bin reference,
INSDC:4na:bin subject, bool has_ref_offset, I32 ref_offset )
= ALIGN:generate_mismatch;
/* ref_pos
* retrieves the alignment's positions on the reference
* one per PLOIDY
*
* "ref_id" [ DATA ]
*
* "ref_start" [ DATA ] - one per PLOIDY
*/
extern function
INSDC:coord:zero NCBI:align:ref_pos #1 ( I64 ref_id, INSDC:coord:zero ref_start );
/* ref_name
* retrieve the name from the reference
*
* "ref_id" [ DATA ]
*/
extern function
ascii NCBI:align:ref_name #1 ( I64 ref_id );
/* ref_seq_id
* retrieve the seq_id from the reference
*
* "ref_id" [ DATA ]
*/
extern function
ascii NCBI:align:ref_seq_id #1 ( I64 ref_id );
/* local_ref_id
* convert global ref_start into ref_id
*/
extern function
I64 NCBI:align:local_ref_id #1 ( U64 global_ref_start );
/* global_ref_id
* convert global ref_start into ref_id
*/
extern function
INSDC:coord:zero NCBI:align:local_ref_start #1 ( U64 global_ref_start );
/* not_my_row
* removes current row_id from the list
*/
extern function I64 NCBI:align:not_my_row #1 ( I64 list );
/* template_len
* compute template length, i.e. the distance from the left-most to the
* right-most matching reference position
*/
extern function I32 NCBI:align:template_len #1 (
INSDC:coord:zero pos, INSDC:coord:zero mate_pos,
INSDC:coord:len reflen, INSDC:coord:len mate_reflen,
ascii ref_name, ascii mate_ref_name, INSDC:coord:one read_id);
/* get_sam_flags
* compute the flags that would be in a SAM file
*
* version 1 works with full Alignment databases.
* version 2 works with Alignment databases that have had SEQUENCE removed.
*/
extern function U32 NCBI:align:get_sam_flags #1 (
INSDC:coord:len read_len, INSDC:coord:one read_id, I32 template_len,
bool strand, bool mate_strand, bool is_secondary, * INSDC:SRA:read_filter filter);
extern function U32 NCBI:align:get_sam_flags #2 (
I64 mate_id, INSDC:coord:one read_id, I32 template_len,
bool strand, bool mate_strand, bool is_secondary, * INSDC:SRA:read_filter filter)
= NCBI:align:get_sam_flags_2;
/* get_left_soft_clip
* compute the length of the soft clip on the left edge of the alignment
*/
extern function INSDC:coord:len NCBI:align:get_left_soft_clip #1
( bool has_ref_offset, I32 ref_offset );
/* get_right_soft_clip
* compute the length of the soft clip on the right edge of the alignment
*/
extern function INSDC:coord:len NCBI:align:get_right_soft_clip #1
( bool has_mismatch, INSDC:coord:len left_clip * bool has_ref_offset );
extern function INSDC:coord:len NCBI:align:get_right_soft_clip #2
( bool has_mismatch, INSDC:coord:len left_clip, bool has_ref_offset, I32 ref_offset )
= NCBI:align:get_right_soft_clip_2;
/* get_clipped_cigar
* compute the CIGAR string with the soft clipping removed
*/
extern function ascii NCBI:align:get_clipped_cigar #1 ( ascii cigar );
/* get_clipped_ref_offset
* compute the reference offsets with the soft clipping removed
*/
extern function I32 NCBI:align:get_clipped_ref_offset #1
( bool has_ref_offset, I32 ref_offset );
/* clip
* remove the soft clipped bases (or qualities, or has_mismatch, or cetera)
* works with things whose lengths are the same as SEQUENCE.READ
*/
extern function < type T > T NCBI:align:clip #1
( T object, INSDC:coord:len left_clip, INSDC:coord:len right_clip);
/* get_ref_len
* compute reference length from alignment information
*/
extern function INSDC:coord:len NCBI:align:get_ref_len #1
( bool has_ref_offset, I32 ref_offset, INSDC:coord:len right_clip );
/* get_mismatch_read
* generate the READ with matching bases replaced with '='
*/
extern function ascii NCBI:align:get_mismatch_read #1
( bool has_mismatch, INSDC:dna:text mismatch );
/* get_ref_mismatch
* shows mismatch positions in reference space
*/
function bool NCBI:align:get_ref_mismatch #1
( bool has_mismatch, bool has_ref_offset, I32 ref_offset,
INSDC:coord:len ref_len );
/* get_ref_insert
* shows positions of inserts in reference space
* i.e. an insert occurs between each pair of true's
*/
function bool NCBI:align:get_ref_insert #1
( bool has_mismatch, bool has_ref_offset, I32 ref_offset,
INSDC:coord:len ref_len );
/* get_ref_delete
* shows positions of deleted bases in reference space
*/
function bool NCBI:align:get_ref_delete #1
( bool has_mismatch, bool has_ref_offset, I32 ref_offset,
INSDC:coord:len ref_len );
/* get_ref_preserve_qual
* compute the positions where corresponding qualities should be preserved
* when converting to an analysis database. In reference coordinate space.
* This is imported by generate_preserve_qual.
* Preserve where:
* one position to each side of a mismatch
* two positions to each side of an indel
*/
function bool NCBI:align:get_ref_preserve_qual #1
( bool has_mismatch, bool has_ref_offset, I32 ref_offset,
INSDC:coord:len ref_len );
/* get_seq_preserve_qual
* the positions where corresponding qualities should be preserved
* when converting to an analysis database. In sequence coordinate space.
*/
function bool NCBI:align:get_seq_preserve_qual #1
( bool ref_preserve_qual, bool has_ref_offset, I32 ref_offset );
/* generate_preserve_qual
* the positions where corresponding qualities should be preserved
* when converting to an analysis database.
* This is pulled from get_ref_preserve_qual, piled up, and or'ed together.
*/
extern function bool NCBI:align:generate_preserve_qual #1
( utf8 ref_name, INSDC:coord:len seq_len, U32 max_seq_len );
extern function INSDC:quality:phred NCBI:align:compress_quality #1
( INSDC:quality:phred quality, bool preserved );
extern function INSDC:quality:phred NCBI:align:decompress_quality #1
< INSDC:quality:phred restored_qual_value >
( INSDC:quality:phred cmp_quality, bool preserved );
/*--------------------------------------------------------------------------
* tables
*/
/* ref_block_cmn
* common implementation ancestor for reference block
*/
table NCBI:align:tbl:ref_block_cmn #1.0.0
{
// TBD:
// Name of Reference table; should be a constant
// extern column zip_encoding < ascii > REF_TABLE;
readonly column ascii REF_TABLE
= < ascii > echo < 'REFERENCE' > ();
// REF_ID is rowid in Reference Table REF_TABLE
extern column I64 REF_ID
= out_ref_id;
// this is a redefinition of REF_START
// REF_START is the offset within REFERENCE.READ
extern column INSDC:coord:zero REF_START
= out_local_ref_start;
// global REF_START
extern column U64 GLOBAL_REF_START
= out_global_ref_start;
// REF_LEN the length of a read projection on reference
// extern column < INSDC:coord:len > izip_encoding REF_LEN;
INSDC:coord:len out_ref_len
= .REF_LEN
| NCBI:align:get_ref_len ( out_has_ref_offset, out_ref_offset, out_right_clip );
physical column < INSDC:coord:len > izip_encoding .REF_LEN = REF_LEN;
extern column INSDC:coord:len REF_LEN = out_ref_len;
// REF_ORIENTATION - relative orientation of original raw read to the reference
// false -> same orientation, true -> opposite orientation
// alignment and reference are always in the same orientation
extern column bool_encoding REF_ORIENTATION;
// REF_PLOIDY
extern column < U32 > izip_encoding REF_PLOIDY;
/* REF_POS
* per PLOIDY
*/
readonly column INSDC:coord:zero REF_POS
= NCBI:align:ref_pos ( out_ref_id, out_local_ref_start );
/* REF_NAME
* the name of the reference
*/
readonly column ascii REF_NAME
= NCBI:align:ref_name ( out_ref_id );
/* REF_SEQ_ID
*/
readonly column ascii REF_SEQ_ID
= NCBI:align:ref_seq_id ( out_ref_id );
};
/* global_ref_block
* reference block favoring global ref-start
*/
table NCBI:align:tbl:global_ref_block #1.0.0
= NCBI:align:tbl:ref_block_cmn #1.0.0
{
U64 out_global_ref_start = .GLOBAL_REF_START;
physical < U64 > izip_encoding .GLOBAL_REF_START = GLOBAL_REF_START;
I64 out_ref_id = NCBI:align:local_ref_id ( .GLOBAL_REF_START );
INSDC:coord:zero out_local_ref_start = NCBI:align:local_ref_start ( .GLOBAL_REF_START );
};
/* local_ref_block
* reference block favoring local ref-start
*/
table NCBI:align:tbl:local_ref_block #1.0.0
= NCBI:align:tbl:ref_block_cmn #1.0.0
{
I64 out_ref_id = .REF_ID;
physical < I64 > izip_encoding .REF_ID = REF_ID;
INSDC:coord:zero out_local_ref_start = .REF_START;
physical < INSDC:coord:zero > izip_encoding .REF_START = REF_START;
};
/* align_cmn
* common interface and implementation for alignment object
*/
table NCBI:align:tbl:align_cmn #1.1.0
= NCBI:tbl:base_space_common #1.0.3
, NCBI:SRA:tbl:stats #1.2.0
, NCBI:align:tbl:ref_block_cmn #1.0.0
{
bool is_secondary = out_is_secondary;
// temporary key
extern column < U32 > izip_encoding TMP_KEY_ID;
/* Raw Sequence Block */
// Points to sequence table, which may contain more information about the raw sequence.
// row id in SEQUENCE table; 0 if not linked
extern column < I64 > izip_encoding SEQ_SPOT_ID;
// read number in SEQUENCE table; { SEQ_SPOT_ID, SEQ_READ_ID } is the unique link to the sequence
extern column < INSDC:coord:one > izip_encoding SEQ_READ_ID;
/* Soft-Clipped data block */
readonly column INSDC:coord:len LEFT_SOFT_CLIP
= NCBI:align:get_left_soft_clip ( HAS_REF_OFFSET, REF_OFFSET );
INSDC:coord:len out_right_clip = NCBI:align:get_right_soft_clip #2( out_has_mismatch, LEFT_SOFT_CLIP, out_has_ref_offset,out_ref_offset );
readonly column INSDC:coord:len RIGHT_SOFT_CLIP = out_right_clip;
readonly column ascii CLIPPED_CIGAR_LONG
= NCBI:align:get_clipped_cigar ( CIGAR_LONG );
readonly column ascii CLIPPED_CIGAR_SHORT
= NCBI:align:get_clipped_cigar ( CIGAR_SHORT );
bool out_clipped_has_mismatch
= < bool > NCBI:align:clip (out_has_mismatch, LEFT_SOFT_CLIP, RIGHT_SOFT_CLIP);
readonly column ascii CLIPPED_HAS_MISMATCH
= < U8 , ascii > map < [ 0 , 1 ] , '01' > ( out_clipped_has_mismatch );
readonly column bool CLIPPED_HAS_MISMATCH = out_clipped_has_mismatch;
bool out_clipped_has_ref_offset
= < bool > NCBI:align:clip (HAS_REF_OFFSET, LEFT_SOFT_CLIP, RIGHT_SOFT_CLIP);
readonly column ascii CLIPPED_HAS_REF_OFFSET
= < U8 , ascii > map < [ 0 , 1 ] , '01' > ( out_clipped_has_ref_offset );
readonly column bool CLIPPED_HAS_REF_OFFSET = out_clipped_has_ref_offset;
readonly column INSDC:dna:text CLIPPED_MISMATCH
= < INSDC:dna:text > NCBI:align:clip ( out_mismatch_dna_text, LEFT_SOFT_CLIP, RIGHT_SOFT_CLIP);
readonly column I32 CLIPPED_REF_OFFSET
= NCBI:align:get_clipped_ref_offset ( HAS_REF_OFFSET, REF_OFFSET );
readonly column INSDC:quality:phred CLIPPED_QUALITY
= < INSDC:quality:phred > NCBI:align:clip (out_qual_phred, LEFT_SOFT_CLIP, RIGHT_SOFT_CLIP);
readonly column INSDC:dna:text CLIPPED_READ
= < INSDC:dna:text > NCBI:align:clip (READ, LEFT_SOFT_CLIP, RIGHT_SOFT_CLIP);
bool out_clipped_preserve_qual
= < bool > NCBI:align:clip (out_seq_preserve_qual, LEFT_SOFT_CLIP, RIGHT_SOFT_CLIP);
readonly column ascii CLIPPED_PRESERVE_QUAL
= < U8 , ascii > map < [ 0 , 1 ] , '01' > ( out_clipped_preserve_qual );
readonly column bool CLIPPED_PRESERVE_QUAL = out_clipped_preserve_qual;
/* Sequence Block */
extern column < NCBI:align:ploidy > izip_encoding PLOIDY;
// Number of reads per spot; corresponds to the number of alternative alignments
// all alternative alignments are computed against the same reference region
U32 out_nreads
= .PLOIDY
| < U32 > echo < 1 > ();
// READ_START and READ_LEN are position and length of the sequence
physical < INSDC:coord:zero > izip_encoding .READ_START = READ_START;
INSDC:coord:zero out_read_start
= .READ_START
| < INSDC:coord:zero > echo < 0 > ();
physical < INSDC:coord:len > izip_encoding .READ_LEN = READ_LEN;
INSDC:coord:len align_spot_len = ( INSDC:coord:len ) row_len ( out_has_ref_offset );
INSDC:coord:len out_read_len
= .READ_LEN
| align_spot_len;
// associated qualities
extern column INSDC:quality:phred CMP_QUALITY
= .CMP_QUALITY
| out_cmp_quality;
physical column < INSDC:quality:phred > zip_encoding .CMP_QUALITY = CMP_QUALITY;
INSDC:quality:phred out_raw_qual = < INSDC:quality:phred >
NCBI:align:project_from_sequence < '( INSDC:quality:phred ) QUALITY'> ( .SEQ_SPOT_ID, .SEQ_READ_ID );
INSDC:quality:phred out_qual_phred
= NCBI:align:decompress_quality < 40 > ( .CMP_QUALITY, PRESERVE_QUAL )
| NCBI:align:raw_restore_qual ( out_raw_qual, .REF_ORIENTATION );
readonly column INSDC:quality:text:phred_33 SAM_QUALITY = QUALITY; // simple alias
// project read group and name
ascii out_spot_group = < ascii > simple_sub_select < 'SEQUENCE','SPOT_GROUP'> (.SEQ_SPOT_ID);
physical zip_encoding .SEQ_NAME = SEQ_NAME;
extern column ascii SEQ_NAME
= .SEQ_NAME
| < ascii > simple_sub_select < 'SEQUENCE','NAME'> (.SEQ_SPOT_ID)
| sprintf < "%u" > ( .SEQ_SPOT_ID );
// compute sam flags
/* blows up parser: starts at schema-tbl.c:2138
readonly column U32 SAM_FLAGS = NCBI:align:get_sam_flags(MATE_ALIGN_ID,
.SEQ_READ_ID, out_template_len, REF_ORIENTATION,
out_mate_ref_orientation, is_secondary);
*/
INSDC:coord:len projected_read_len
= < INSDC:coord:len > simple_sub_select < 'SEQUENCE', 'READ_LEN' > ( .SEQ_SPOT_ID );
readonly column U32 SAM_FLAGS
= NCBI:align:get_sam_flags #1 (projected_read_len,
.SEQ_READ_ID, out_template_len, REF_ORIENTATION,
out_mate_ref_orientation, is_secondary, out_rd_filter)
| NCBI:align:get_sam_flags #2 (out_mate_align_id,
.SEQ_READ_ID, out_template_len, REF_ORIENTATION,
out_mate_ref_orientation, is_secondary, out_rd_filter);
ascii out_name_fmt = < ascii > echo < '$R' > ();
INSDC:coord:zero trim_start
= < INSDC:coord:zero > echo < 0 > ();
INSDC:coord:len trim_len
= align_spot_len;
ascii out_label
= .LABEL
| < ascii > echo < "ploidy1" > ();
INSDC:coord:zero out_label_start
= .LABEL_START
| < INSDC:coord:zero > echo < 0 > ();
INSDC:coord:len out_label_len
= .LABEL_LEN
| < INSDC:coord:len > echo < 7 > ();
physical < INSDC:SRA:read_filter > zip_encoding .RD_FILTER = READ_FILTER;
INSDC:SRA:read_filter out_rd_filter
= .RD_FILTER
| < INSDC:SRA:read_filter > NCBI:align:project_from_sequence < 'READ_FILTER' > ( .SEQ_SPOT_ID, .SEQ_READ_ID )
| < INSDC:SRA:read_filter > echo < SRA_READ_FILTER_PASS > ( out_ref_len );
INSDC:SRA:platform_id out_platform
= .PLATFORM
| < INSDC:SRA:platform_id > echo < SRA_PLATFORM_UNDEFINED > ();
/* out_read_type
* set to SRA_READ_TYPE_FORWARD + SRA_READ_TYPE_BIOLOGICAL
* which has a constant value of 3
*/
INSDC:SRA:xread_type out_read_type
= < INSDC:SRA:xread_type > echo < 3 > ( out_read_len );
// stats inputs
bool in_stats_bin = HAS_REF_OFFSET;
INSDC:coord:len _alt_in_read_len
= READ_LEN
| ( INSDC:coord:len ) row_len #1 ( HAS_REF_OFFSET );
INSDC:SRA:xread_type _alt_in_read_type
= READ_TYPE
| < INSDC:SRA:xread_type > echo < SRA_READ_TYPE_BIOLOGICAL > (_alt_in_read_len);
readonly column ascii MISMATCH_READ
= NCBI:align:get_mismatch_read ( out_has_mismatch, out_mismatch_dna_text );
/* Alignment block */
// MAPQ - single value quality of the mapping; the scale is submitter specific
extern column < I32 > izip_encoding MAPQ;
extern column INSDC:coord:zero MATE_REF_POS = out_mate_ref_pos;
extern column INSDC:coord:len MATE_REF_LEN = out_mate_ref_len;
extern column I64 MATE_REF_ID = out_mate_ref_id;
extern column I32 TEMPLATE_LEN = out_template_len;
extern column bool MATE_REF_ORIENTATION = out_mate_ref_orientation;
readonly column ascii MATE_REF_NAME = NCBI:align:ref_name ( out_mate_ref_id );
/********************************
* Columns representing CIGARs
********************************/
// one value per base i.e. length is same as sum of READ_LEN
// partitioned by READ_START and READ_LEN into alternative alignments
// flags the shifts in reference position preceeding the base
// if sequence of a partitioned read starts with a ref_offset and one or more mismatches
// then it represents a left soft clip
// any run of mismatches at the end represents a right soft clip
readonly column ascii HAS_REF_OFFSET = < U8 , ascii > map < [ 0 , 1 ] , '01' > ( out_has_ref_offset );
extern column bool_encoding HAS_REF_OFFSET;
bool out_has_ref_offset = .HAS_REF_OFFSET;
// has number of elements equal to number of true elements in HAS_REF_OFFSET
extern column < I32 > izip_encoding REF_OFFSET;
I32 out_ref_offset = .REF_OFFSET;
// DISPLAY Columns
readonly column I64 ALIGN_ID = row_id ();
// get projection of the reference
readonly column INSDC:dna:text REF_READ
= < INSDC:4na:bin, INSDC:dna:text > map < INSDC:4na:map:BINSET, INSDC:4na:map:CHARSET > ( REF_READ );
// TDB: fix this function
readonly column INSDC:4na:bin REF_READ
= NCBI:align:ref_sub_select (out_ref_id, out_local_ref_start, out_ref_len, .REF_PLOIDY)
| NCBI:align:ref_sub_select (out_ref_id, out_local_ref_start, out_ref_len );
bool in_preserve_qual_ref
= NCBI:align:ref_sub_select_preserve_qual (out_ref_id, out_local_ref_start, out_ref_len, .REF_PLOIDY)
| NCBI:align:ref_sub_select_preserve_qual (out_ref_id, out_local_ref_start, out_ref_len );
readonly column ascii PRESERVE_QUAL_REF = < U8 , ascii > map < [ 0 , 1 ] , '01' > ( in_preserve_qual_ref );
readonly column bool PRESERVE_QUAL_REF = in_preserve_qual_ref;
INSDC:quality:phred out_cmp_quality
= NCBI:align:compress_quality ( CLIPPED_QUALITY, CLIPPED_PRESERVE_QUAL );
// text forms of reads
INSDC:dna:text out_dna_text
= < INSDC:4na:bin, INSDC:dna:text > map < INSDC:4na:map:BINSET, INSDC:4na:map:CHARSET > ( out_4na_bin );
readonly column INSDC:dna:text RAW_READ
= < INSDC:4na:bin, INSDC:dna:text > map < INSDC:4na:map:BINSET, INSDC:4na:map:CHARSET > ( out_raw_read );
readonly column INSDC:4na:bin RAW_READ
= out_raw_read;
// CIGARs
// TBD: when PLOIDY more than 1
readonly column ascii CIGAR_LONG = NCBI:align:cigar < 1 > (out_has_mismatch, out_has_ref_offset, out_ref_offset);
readonly column ascii CIGAR_SHORT = NCBI:align:cigar < 0 > (out_has_mismatch, out_has_ref_offset, out_ref_offset);
readonly column U32 EDIT_DISTANCE = NCBI:align:edit_distance (out_has_mismatch, out_has_ref_offset, out_ref_offset);
readonly column ascii HAS_MISMATCH = < U8 , ascii > map < [ 0 , 1 ] , '01' > ( out_has_mismatch );
// needed for backward compatibility
readonly column ascii SEQ_SPOT_GROUP = out_spot_group;
/* These columns for calculating the positions where quality is preserved when
* converting to an analysis database.
*/
bool out_ref_preserve_qual = NCBI:align:get_ref_preserve_qual ( out_has_mismatch, out_has_ref_offset, out_ref_offset, out_ref_len );
readonly column ascii REF_PRESERVE_QUAL = < U8 , ascii > map < [ 0 , 1 ] , '01' > ( out_ref_preserve_qual );
readonly column bool REF_PRESERVE_QUAL = out_ref_preserve_qual;
bool out_seq_preserve_qual = NCBI:align:get_seq_preserve_qual ( in_preserve_qual_ref, out_has_ref_offset, out_ref_offset );
readonly column ascii PRESERVE_QUAL = < U8 , ascii > map < [ 0 , 1 ] , '01' > ( out_seq_preserve_qual );
readonly column bool PRESERVE_QUAL = out_seq_preserve_qual;
/* These columns are purely informational. */
bool out_ref_mismatch = NCBI:align:get_ref_mismatch ( out_has_mismatch, out_has_ref_offset, out_ref_offset, out_ref_len );
readonly column ascii REF_MISMATCH = < U8 , ascii > map < [ 0 , 1 ] , '01' > ( out_ref_mismatch );
readonly column bool REF_MISMATCH = out_ref_mismatch;
bool out_ref_insert = NCBI:align:get_ref_insert ( out_has_mismatch, out_has_ref_offset, out_ref_offset, out_ref_len );
readonly column ascii REF_INSERT = < U8 , ascii > map < [ 0 , 1 ] , '01' > ( out_ref_insert );
readonly column bool REF_INSERT = out_ref_insert;
bool out_ref_delete = NCBI:align:get_ref_delete ( out_has_mismatch, out_has_ref_offset, out_ref_offset, out_ref_len );
readonly column ascii REF_DELETE = < U8 , ascii > map < [ 0 , 1 ] , '01' > ( out_ref_delete );
readonly column bool REF_DELETE = out_ref_delete;
};
/* align_full
* aligns externally stored sequence against reference
* alignment transcript is calculated
*/
table NCBI:align:tbl:align_full #1.0.0
= NCBI:align:tbl:align_cmn #1.1.0
{
bool out_is_secondary = echo < true > ();
// restore reads to its raw form (orientation is restored)
INSDC:4na:bin out_raw_read
= < INSDC:4na:bin > simple_sub_select < 'PRIMARY_ALIGNMENT', '( INSDC:4na:bin ) RAW_READ' > (PRIMARY_ALIGNMENT_ID)
| < INSDC:4na:bin > NCBI:align:project_from_sequence < '( INSDC:4na:bin ) READ'> ( .SEQ_SPOT_ID, .SEQ_READ_ID );
INSDC:4na:bin out_4na_bin = NCBI:align:raw_restore_read ( out_raw_read, .REF_ORIENTATION );
// flags mismatches with the reference
// produced by actual comparison of REF_READ and READ
bool out_has_mismatch
= NCBI:align:generate_has_mismatch ( REF_READ, READ, out_has_ref_offset, out_ref_offset );
INSDC:4na:bin out_mismatch_4na_bin
= NCBI:align:generate_mismatch ( REF_READ, READ, out_has_ref_offset, out_ref_offset );
INSDC:dna:text out_mismatch_dna_text
= < INSDC:4na:bin, INSDC:dna:text > map < INSDC:4na:map:BINSET, INSDC:4na:map:CHARSET > ( out_mismatch_4na_bin );
readonly column INSDC:dna:text MISMATCH = out_mismatch_dna_text;
readonly column INSDC:4na:bin MISMATCH = out_mismatch_4na_bin;
physical column < INSDC:coord:zero > izip_encoding .MATE_REF_POS = MATE_REF_POS;
INSDC:coord:zero out_mate_ref_pos = .MATE_REF_POS;
physical column < I64 > izip_encoding .MATE_REF_ID = MATE_REF_ID;
I64 out_mate_ref_id = .MATE_REF_ID;
physical column < I32 > izip_encoding .TEMPLATE_LEN = TEMPLATE_LEN;
I32 out_template_len = .TEMPLATE_LEN;
physical column < bool > izip_encoding .MATE_REF_ORIENTATION = MATE_REF_ORIENTATION;
bool out_mate_ref_orientation = .MATE_REF_ORIENTATION;
I64 out_mate_align_id = .MATE_ALIGN_ID;
physical column izip_encoding .MATE_ALIGN_ID = MATE_ALIGN_ID;
extern column I64 MATE_ALIGN_ID = out_mate_align_id;
physical column < I64 > izip_encoding .PRIMARY_ALIGNMENT_ID = PRIMARY_ALIGNMENT_ID;
I32 read_idx = cast (.SEQ_READ_ID);
extern column I64 PRIMARY_ALIGNMENT_ID
= .PRIMARY_ALIGNMENT_ID
| simple_sub_select < 'SEQUENCE','PRIMARY_ALIGNMENT_ID' > (.SEQ_SPOT_ID,.SEQ_READ_ID);
};
/* compressed_by_reference
* aligns internally represented sequence against reference
* alignment transcript is stored
* original sequence is reconstructed
*/
table NCBI:align:tbl:compressed_by_reference #1.0.0
= NCBI:align:tbl:align_cmn #1.1.0
{
bool out_is_secondary = echo < false > ();
// one value per base i.e. length is same as sum of READ_LEN
// partitioned by READ_START and READ_LEN into alternative alignments
// flags mismatches with the reference
extern default column bool_encoding HAS_MISMATCH;
bool out_has_mismatch = .HAS_MISMATCH;
// has number of elements equal to number of true elements in HAS_MISMATCH
extern column INSDC:dna:text MISMATCH = out_mismatch_dna_text;
INSDC:dna:text in_mismatch_dna_text
= < INSDC:dna:text, INSDC:dna:text > map < '.acmgrsvtwyhkdbn','NACMGRSVTWYHKDBN' > ( MISMATCH );
INSDC:4na:bin in_mismatch_4na_bin
= < INSDC:dna:text, INSDC:4na:bin > map < INSDC:4na:map:CHARSET, INSDC:4na:map:BINSET > ( in_mismatch_dna_text );
physical column < INSDC:4na:bin > zip_encoding .MISMATCH = in_mismatch_4na_bin;
INSDC:4na:bin out_mismatch_4na_bin = .MISMATCH;
INSDC:dna:text out_mismatch_dna_text
= < INSDC:4na:bin, INSDC:dna:text > map < INSDC:4na:map:BINSET, INSDC:4na:map:CHARSET > ( out_mismatch_4na_bin );
I64 out_mate_align_id
= .MATE_ALIGN_ID
| NCBI:align:not_my_row (primary_align_pair);
physical column izip_encoding .MATE_ALIGN_ID = MATE_ALIGN_ID;
extern column I64 MATE_ALIGN_ID = out_mate_align_id;
// restore reads from alignment columns and the reference
// TBD: update for PLOIDY by looping in REF_READ
INSDC:4na:bin out_4na_bin = NCBI:align:align_restore_read ( REF_READ,
out_has_mismatch, .MISMATCH, out_has_ref_offset, out_ref_offset );
// restore reads to its raw form (orientation is restored)
INSDC:4na:bin out_raw_read = NCBI:align:raw_restore_read (out_4na_bin,.REF_ORIENTATION);
I64 primary_align_pair = < I64 > simple_sub_select < 'SEQUENCE','PRIMARY_ALIGNMENT_ID'> (.SEQ_SPOT_ID);
I64 out_mate_ref_id = < I64 > simple_sub_select < '','REF_ID'> (MATE_ALIGN_ID);
bool out_mate_ref_orientation = < bool > simple_sub_select < '','REF_ORIENTATION'> (MATE_ALIGN_ID);
INSDC:coord:zero out_mate_ref_pos = < INSDC:coord:zero > simple_sub_select < '','REF_POS'> (MATE_ALIGN_ID);
INSDC:coord:len out_mate_ref_len = < INSDC:coord:len > simple_sub_select < '','REF_LEN'> (MATE_ALIGN_ID);
readonly column U32 MATE_EDIT_DISTANCE = < U32 > simple_sub_select < '','EDIT_DISTANCE'> (MATE_ALIGN_ID);
readonly column ascii MATE_CIGAR_LONG = < ascii > simple_sub_select < '','CIGAR_LONG'> (MATE_ALIGN_ID);
readonly column ascii MATE_CIGAR_SHORT = < ascii > simple_sub_select < '','CIGAR_SHORT'> (MATE_ALIGN_ID);
I32 out_template_len = NCBI:align:template_len (REF_POS,out_mate_ref_pos,out_ref_len,out_mate_ref_len,REF_NAME,MATE_REF_NAME,SEQ_READ_ID);
};
/* align_sorted
* deflated alignment data sorted against reference
*/
table NCBI:align:tbl:align_sorted #1.0.0
= NCBI:align:tbl:compressed_by_reference #1.0.0
, NCBI:align:tbl:global_ref_block #1.0.0
{
};
/* align_unsorted
* deflated alignment unsorted data
*/
table NCBI:align:tbl:align_unsorted #1.0.0
= NCBI:align:tbl:compressed_by_reference #1.0.0
, NCBI:align:tbl:local_ref_block #1.0.0
{
};
/* align_mate_sorted
*/
table NCBI:align:tbl:align_mate_sorted #1.0.0
= NCBI:align:tbl:align_full #1.0.0
, NCBI:align:tbl:global_ref_block #1.0.0
{
};
/* align_mate_unsorted
*/
table NCBI:align:tbl:align_mate_unsorted #1.0.0
= NCBI:align:tbl:align_full #1.0.0
, NCBI:align:tbl:local_ref_block #1.0.0
{
};
/*--------------------------------------------------------------------------
* seq
* alignment sequence table
*/
physical
I64 NCBI:align:sorted:alignment_id_encoding #1.0
{
decode
{
I64 outliers_removed = iunzip ( @ );
return < I64 > outlier_decode < 0 > ( outliers_removed );
}
encode
{
I64 outliers_removed = < I64 > outlier_encode < 0 > ( @ );
return izip ( outliers_removed );
}
}
table NCBI:align:tbl:seq #1.0.0 =
NCBI:tbl:base_space #2.0.3,
NCBI:tbl:phred_quality #2.0.3,
NCBI:align:tbl:cmp_base_space #1,
NCBI:SRA:tbl:spotdesc #1.0.2,
NCBI:SRA:tbl:stats #1.2.0
{
// gets primary record in alignment table (size of column is NREADS)
// if sorted - should used special encoding
extern column izip_encoding PRIMARY_ALIGNMENT_ID;
INSDC:coord:zero trim_start = < INSDC:coord:zero > echo < 0 > ();
INSDC:coord:len trim_len = _spot_len;
// size is NREADS
extern column < U8 > zip_encoding ALIGNMENT_COUNT;
// auto-generate name from row-id
ascii out_name_fmt = < ascii > echo < '$R' > ();
// temparary column
extern column < U32 > izip_encoding TMP_KEY_ID;
//Restored READ
INSDC:4na:bin out_dcmp_4na_bin
= NCBI:align:seq_restore_read (out_cmp_4na_bin, .PRIMARY_ALIGNMENT_ID, .READ_LEN, .READ_TYPE);
};
/***********************************
* Reference table - to store reference sequences
* Sequences are divided in chunks. Two sequences never share a chunk.
* SEQ_LEN - real size of a chunk should never exceed MAX_SEQ_LEN when it is set
* READ - inherited from NCBI:tbl:base_space
* CMP_READ,CMP_ALTREAD - are inherited from NCBI:align:tbl:cmp_base_space
* SEQ_ID,SEQ_START,SEQ_LEN are inherited from NCBI:align:tbl:seqloc
* .skey contains NAME of the chunk - it corresponds to actual name used in BAM (chr1,chr2, etc....)
*
* SEQ_START,SEQ_LEN,MAX_SEQ_LEN,SEQID and rowlen(READ) operate the following way
* - SEQ_LEN < MAX_SEQ_LEN - should only happen on the last chunk of the sequence
* - .READ is absent - there should be a retrieval from external services by SEQ_ID,SEQ_START,SEQ_LEN
* - rowlen(.READ) = 0 && SEQ_START==0 (used as flag) - the sequence is SEQ_LEN repetition of 'N'
* - rowlen(.READ) = 0 && SEQ_START >= 1 - the sequence have to be fetched from external sources
* - 0 < rowlen(.READ)< SEQ_LEN -- the sequence have to be filled with 'N's
*
v***********************************/
table NCBI:align:tbl:reference #1.1.0 =
NCBI:align:tbl:cmp_base_space #1,
NCBI:tbl:base_space #2.0.3,
NCBI:tbl:seqloc #1,
NCBI:SRA:tbl:stats #1.2.0
{
INSDC:quality:phred out_qual_phred
= < INSDC:quality:phred > echo < 30 > ( out_dcmp_4na_bin );
// MAX_SEQ_LEN - should be a constant == static column
extern column < U32 > izip_encoding MAX_SEQ_LEN;
// indicates if sequence has circular structure
// copied from refSeq
extern column bool_encoding CIRCULAR;
// make CS_KEY writable
INSDC:dna:text in_cs_key
= < INSDC:dna:text, INSDC:dna:text > map < 'acgtn', 'ACGTN' > ( CS_KEY );
physical column < INSDC:dna:text > zip_encoding .CS_KEY = in_cs_key;
U32 in_spot_len = SEQ_LEN;
INSDC:coord:len _alt_in_read_len
= READ_LEN
| SEQ_LEN;
INSDC:SRA:xread_type _alt_in_read_type
= READ_TYPE
| < INSDC:SRA:xread_type > echo < SRA_READ_TYPE_BIOLOGICAL > ();
// extra columns needed for CS conversion
INSDC:coord:zero out_read_start = < INSDC:coord:zero > echo < 0 > ();
INSDC:coord:len out_read_len = .SEQ_LEN;
extern column utf8 NAME = out_spot_name_utf8;
physical utf8 .NAME = idx:text:insert < 'i_name' > ( NAME );
utf8 out_spot_name_utf8 = idx:text:project < 'i_name' > (.NAME );
ascii out_spot_name = cast ( out_spot_name_utf8 );
INSDC:coord:zero trim_start = < INSDC:coord:zero > echo < 0 > ();
INSDC:coord:len trim_len = base_space_spot_len;
ascii out_label
= < ascii > echo < "reference" > ();
INSDC:coord:zero out_label_start
= < INSDC:coord:zero > echo < 0 > ();
INSDC:coord:len out_label_len
= < INSDC:coord:len > echo < 9 > ();
U32 out_nreads
= < U32 > echo < 1 > ();
INSDC:SRA:xread_type out_read_type
= < INSDC:SRA:xread_type > echo < 3 > ();
INSDC:SRA:read_filter out_rd_filter
= < INSDC:SRA:read_filter > echo < SRA_READ_FILTER_PASS > ();
// Columns of computed coverages by alignment
// Preserve Quality bit map
extern column bool PRESERVE_QUAL = out_preserve_qual;
physical bool_encoding .PRESERVE_QUAL = PRESERVE_QUAL;
bool out_preserve_qual
= .PRESERVE_QUAL
| NCBI:align:generate_preserve_qual(NAME, SEQ_LEN, .MAX_SEQ_LEN);
readonly default column ascii PRESERVE_QUAL = < U8 , ascii > map < [ 0 , 1 ] , '01' > ( out_preserve_qual );
// TBD: use percentiles instead of min/max?
// maximum value clipped at 255 of the coverage density
// for a chunk
extern column < U8 > izip_encoding CGRAPH_HIGH;
// minimum value clipped at 255 of the coverage density
// for a chunk
extern column < U8 > izip_encoding CGRAPH_LOW;
// count of the number of mismatches in the chunk
extern column < U32 > izip_encoding CGRAPH_MISMATCHES;
// count of the number of inserts and deletes in the chunk
extern column < U32 > izip_encoding CGRAPH_INDELS;
// List of row ids from alignment tables
extern column < I64 > izip_encoding PRIMARY_ALIGNMENT_IDS;
extern column < I64 > izip_encoding SECONDARY_ALIGNMENT_IDS;
// Mechanism to seach for NAME
readonly column vdb:row_id_range NAME_RANGE
= idx:text:lookup < 'i_name', 'QUERY_SEQ_NAME' > ();
// Fully instantiates READ
INSDC:4na:bin out_dcmp_4na_bin
= NCBI:align:ref_restore_read (out_cmp_4na_bin, .SEQ_ID, .SEQ_START, .SEQ_LEN);
}
// THE DATABASES
database NCBI:align:db:alignment_sorted #1.1
{
table NCBI:align:tbl:reference #1.1 REFERENCE;
table NCBI:align:tbl:align_sorted #1.0 PRIMARY_ALIGNMENT;
table NCBI:align:tbl:align_mate_sorted #1.0 SECONDARY_ALIGNMENT;
table NCBI:align:tbl:seq #1.0 SEQUENCE;
table NCBI:align:tbl:qstat #1.0 QUAL_STAT;
};
database NCBI:align:db:alignment_unsorted #1.1
{
table NCBI:align:tbl:reference #1.1 REFERENCE;
table NCBI:align:tbl:align_unsorted #1.0 PRIMARY_ALIGNMENT;
table NCBI:align:tbl:align_mate_unsorted #1.0 SECONDARY_ALIGNMENT;
table NCBI:align:tbl:seq #1.0 SEQUENCE;
table NCBI:align:tbl:qstat #1.0 QUAL_STAT;
};
database NCBI:align:db:alignment_evidence #1.1
{
table NCBI:align:tbl:reference #1.1 REFERENCE;
table NCBI:align:tbl:align_unsorted #1.0 PRIMARY_ALIGNMENT;
table NCBI:align:tbl:align_mate_unsorted #1.0 SECONDARY_ALIGNMENT;
table NCBI:align:tbl:align_unsorted #1.0 EVIDENCE_INTERVAL;
table NCBI:align:tbl:align_mate_unsorted #1.0 EVIDENCE_ALIGNMENT;
table NCBI:align:tbl:seq #1.0 SEQUENCE;
table NCBI:align:tbl:qstat #1.0 QUAL_STAT;
};
sra_sdk-2.1.7/interfaces/align/alignarc.h 0000644 0012213 0011620 00000003476 11476747550 020033 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_align_alignarc_
#define _h_align_alignarc_
#ifndef _h_klib_defs_
#include
#endif
#ifndef _h_align_extern_
#include
#endif
#include
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* AlignMgr
* opaque handle to Alignment Archive
*/
typedef struct AlignMgr AlignMgr;
/*--------------------------------------------------------------------------
* AlignTable
* an alignment guy
*/
typedef struct AlignTable AlignTable;
#ifdef __cplusplus
}
#endif
#endif /* _h_align_alignarc_ */
sra_sdk-2.1.7/interfaces/align/alignsrc.h 0000644 0012213 0011620 00000004137 11476747550 020050 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_align_alignsrc_
#define _h_align_alignsrc_
#ifndef _h_align_extern_
#include
#endif
#include
#include
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* AlignSrc
* an alignment guy
*/
typedef struct AlignSrc AlignSrc;
/* Make
* create an alignment source object from BAM file
*
* "as" [ OUT ] - return parameter for AlignSrc object
*
* "bam" [ IN ] - NUL terminated path to BAM file
*
* "bai" [ IN, NULL OKAY ] - optional NUL terminated path to BAM index file
*/
ALIGN_EXTERN int CC AlignSrcMakeFromBAM ( const AlignSrc **as, const char *bam, const char *bai );
/* Dispose
* release all resources associated with alignment source
*/
ALIGN_EXTERN int CC AlignSrcDispose ( const AlignSrc *self );
#ifdef __cplusplus
}
#endif
#endif /* _h_align_alignsrc_ */
sra_sdk-2.1.7/interfaces/align/extern.h 0000644 0012213 0011620 00000002765 11476747550 017560 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_align_extern_
#define _h_align_extern_
#if ! defined EXPORT_LATCH && defined _LIBRARY
#define ALIGN_EXTERN LIB_EXPORT
#define EXPORT_LATCH 1
#else
#define ALIGN_EXTERN LIB_IMPORT
#endif
#ifndef _h_klib_extern_
#include
#endif
#endif /* _h_align_extern_ */
sra_sdk-2.1.7/interfaces/align/bam.h 0000644 0012213 0011620 00000062455 11645077605 017007 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_align_bam_
#define _h_align_bam_
#ifndef _h_align_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#include
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KDirectory;
struct KFile;
struct KPath;
struct AlignAccessDB;
struct AlignAccessAlignmentEnumerator;
/*--------------------------------------------------------------------------
* BAMAlignment
*/
typedef struct BAMAlignment BAMAlignment;
/* GetBAMAlignment
* get property
*
* Release with BAMAlignmentRelease.
*/
ALIGN_EXTERN rc_t CC AlignAccessAlignmentEnumeratorGetBAMAlignment
( const struct AlignAccessAlignmentEnumerator *self, const BAMAlignment **result );
/* AddRef
* Release
*/
ALIGN_EXTERN rc_t CC BAMAlignmentAddRef ( const BAMAlignment *self );
ALIGN_EXTERN rc_t CC BAMAlignmentRelease ( const BAMAlignment *self );
/* GetReadLength
* get the sequence length
* i.e. the number of elements of both sequence and quality
*
* "length" [ OUT ] - length in bases of query sequence and quality
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetReadLength ( const BAMAlignment *self, uint32_t *length );
/* GetSequence
* get the sequence data [0..ReadLength)
* caller provides buffer of ReadLength bytes
*
* "sequence" [ OUT ] - pointer to a buffer of at least ReadLength bytes
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetSequence ( const BAMAlignment *self, char *sequence );
/* GetSequence2
* get the sequence data [0..ReadLength)
* caller provides buffer of ReadLength bytes
*
* "sequence" [ OUT ] - pointer to a buffer of at least ReadLength bytes
*
* "start" [ IN ] and "stop" [ IN ] - zero-based coordinates, half-closed interval
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetSequence2 ( const BAMAlignment *self, char *sequence, uint32_t start, uint32_t stop);
/* GetQuality
* get the raw quality data [0..ReadLength)
* values are unsigned with 0xFF == missing
*
* "quality" [ OUT ] - return param for quality sequence
* held internally, validity is guaranteed for the life of the BAMAlignment
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetQuality ( const BAMAlignment *self, const uint8_t **quality );
/* GetQuality2
* get the raw quality data [0..ReadLength) from OQ if possible else from QUAL
* values are unsigned with 0xFF == missing
*
* "quality" [ OUT ] - return param for quality sequence
* held internally, validity is guaranteed for the life of the BAMAlignment
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetQuality2(const BAMAlignment *self, const uint8_t **quality, uint8_t *offset);
/* GetRefSeqId
* get id of reference sequence
* pass result into BAMFileGetRefSeqById to get the Reference Sequence record
*
* "refSeqId" [ OUT ] - zero-based id of reference sequence
* returns -1 if set as invalid within BAM ( rc may be zero )
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetRefSeqId ( const BAMAlignment *self, int32_t *refSeqId );
/* GetMateRefSeqId
* get id of mate's reference sequence
* pass result into BAMFileGetRefSeqById to get the Reference Sequence record
*
* "refSeqId" [ OUT ] - zero-based id of reference sequence
* returns -1 if invalid
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetMateRefSeqId ( const BAMAlignment *self, int32_t *refSeqId );
/* GetPosition
* get the aligned position on the ref. seq.
*
* "n" [ IN ] - zero-based position index for cases of multiple alignments
*
* "pos" [ OUT ] - zero-based position on reference sequence
* returns -1 if invalid
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetPosition ( const BAMAlignment *self, int64_t *pos );
/* GetPosition2
* get the aligned start position on the ref. seq.
* get the aligned length on the ref. seq.
*
* "n" [ IN ] - zero-based position index for cases of multiple alignments
*
* "pos" [ OUT ] - zero-based position on reference sequence
* returns -1 if invalid
*
* "length" [ OUT ] - length of alignment on reference sequence
* returns 0 if invalid
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetPosition2 ( const BAMAlignment *self, int64_t *pos, uint32_t *length );
/* GetMatePosition
* starting coordinate of mate's alignment on ref. seq.
*
* "pos" [ OUT ] - zero-based position on reference sequence
* returns -1 if invalid
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetMatePosition ( const BAMAlignment *self, int64_t *pos );
/* IsMapped
* is the alignment mapped to something
*/
ALIGN_EXTERN bool CC BAMAlignmentIsMapped ( const BAMAlignment *self );
/* GetReadGroupName
* get the name of the read group (i.e. accession)
* pass result into BAMFileGetReadGroupByName to get the Read Group record
*
* "name" [ OUT ] - return param for NUL-terminated read group name
* held internally, validity is guaranteed for the life of the BAMAlignment
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetReadGroupName ( const BAMAlignment *self, const char **name );
/* GetReadName
* get the read name (i.e. spot name)
* GetReadName2
* get the read name and length in bytes
*
* "name" [ OUT ] - return param for NUL-terminated read group name
* held internally, validity is guaranteed for the life of the BAMAlignment
*
* "length" [ OUT ] - return the number of bytes in "name"
* excluding terminating NUL.
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetReadName ( const BAMAlignment *self, const char **name );
ALIGN_EXTERN rc_t CC BAMAlignmentGetReadName2 ( const BAMAlignment *self, const char **name, size_t *length );
/* HasColorSpace
* Does the alignment have colorspace info
*/
ALIGN_EXTERN bool CC BAMAlignmentHasColorSpace ( const BAMAlignment *self );
/* GetCSKey
* get the colorspace key
*
* "cskey" [ OUT ] - return param
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetCSKey ( const BAMAlignment *self, char cskey[1] );
/* GetCSSequence
* get the colorspace sequence data [0..ReadLength)
* caller provides buffer of ReadLength bytes
*
* "csseq" [ OUT ] - pointer to a buffer of at least ReadLength bytes
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetCSSequence ( const BAMAlignment *self, char csseq[] );
/* GetFlags
* return the raw "flags" bitmap word
*
* "flags" [ OUT ] - return parameter for bitmap word
*/
enum BAMFlags
{
BAMFlags_bit_WasPaired = 0, /* was paired when sequenced */
BAMFlags_bit_IsMappedAsPair,
BAMFlags_bit_SelfIsUnmapped,
BAMFlags_bit_MateIsUnmapped,
BAMFlags_bit_SelfIsReverse,
BAMFlags_bit_MateIsReverse,
BAMFlags_bit_IsFirst, /* and mate exists */
BAMFlags_bit_IsSecond, /* and mate exists */
BAMFlags_bit_IsNotPrimary, /* a read having split hits may have multiple primary alignments */
BAMFlags_bit_IsLowQuality, /* fails platform/vendor quality checks */
BAMFlags_bit_IsDuplicate, /* PCR or optical dup */
BAMFlags_WasPaired = (1 << BAMFlags_bit_WasPaired),
BAMFlags_IsMappedAsPair = (1 << BAMFlags_bit_IsMappedAsPair),
BAMFlags_SelfIsUnmapped = (1 << BAMFlags_bit_SelfIsUnmapped),
BAMFlags_MateIsUnmapped = (1 << BAMFlags_bit_MateIsUnmapped),
BAMFlags_SelfIsReverse = (1 << BAMFlags_bit_SelfIsReverse),
BAMFlags_MateIsReverse = (1 << BAMFlags_bit_MateIsReverse),
BAMFlags_IsFirst = (1 << BAMFlags_bit_IsFirst),
BAMFlags_IsSecond = (1 << BAMFlags_bit_IsSecond),
BAMFlags_IsNotPrimary = (1 << BAMFlags_bit_IsNotPrimary),
BAMFlags_IsLowQuality = (1 << BAMFlags_bit_IsLowQuality),
BAMFlags_IsDuplicate = (1 << BAMFlags_bit_IsDuplicate)
};
ALIGN_EXTERN rc_t CC BAMAlignmentGetFlags ( const BAMAlignment *self, uint16_t *flags );
/* GetMapQuality
* return the quality score of mapping
*
* "qual" [ OUT ] - return param for quality score
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetMapQuality ( const BAMAlignment *self, uint8_t *qual );
/* GetAlignmentDetail
* get the alignment details
*
* "rslt" [ OUT, NULL OKAY ] and "count" [ IN ] - array to hold detail records
*
* "actual" [ OUT, NULL OKAY ] - number of elements written to "rslt"
* required if "rslt" is not NULL
*
* "firstMatch" [ OUT, NULL OKAY ] - zero-based index into "rslt" of the first match to the refSeq
* or < 0 if invalid
*
* "lastMatch" [ OUT, NULL OKAY ] - zero-based index into "rslt" of the last match to the refSeq
* or < 0 if invalid
*/
typedef uint32_t BAMCigarType;
enum BAMCigarTypes
{
ct_Match = 'M',
ct_Insert = 'I',
ct_Delete = 'D',
ct_Skip = 'N',
ct_SoftClip = 'S',
ct_HardClip = 'H',
ct_Padded = 'P',
ct_Equal = '=',
ct_NotEqual = 'X',
ct_Overlap = 'B' /* Complete Genomics extension */
};
typedef struct BAMAlignmentDetail BAMAlignmentDetail;
struct BAMAlignmentDetail
{
int64_t refSeq_pos; /* position on refSeq where this alignment region starts or -1 if NA */
int32_t read_pos; /* position on read where this alignment region starts or -1 if NA */
uint32_t length; /* length of alignment region */
BAMCigarType type; /* type of alignment */
};
ALIGN_EXTERN rc_t CC BAMAlignmentGetAlignmentDetail ( const BAMAlignment *self,
BAMAlignmentDetail *rslt, uint32_t count, uint32_t *actual,
int32_t *firstMatch, int32_t *lastMatch );
/* GetCigarCount
* the number of CIGAR elements
* a CIGAR element consists of the pair of matching op code and op length
*
* "n" [ OUT ] - return param for cigar count
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetCigarCount ( const BAMAlignment *self, uint32_t *n );
ALIGN_EXTERN rc_t CC BAMAlignmentGetRawCigar(const BAMAlignment *cself, uint32_t const **rslt, uint32_t *length);
/* GetCigar
* get CIGAR element n [0..GetCigarCount)
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetCigar ( const BAMAlignment *self,
uint32_t n, BAMCigarType *type, uint32_t *length );
/* GetInsertSize
* distance in bases to start of mate's alignment on ref. seq.
*
* "size" [ OUT ] - >0 for first in pair, <0 for second
*/
ALIGN_EXTERN rc_t CC BAMAlignmentGetInsertSize ( const BAMAlignment *self, int64_t *size );
/* OptDataForEach
* DANGER
* these optional fields are the weakest part of BAM.
*
* It is probably best to not use this info.
* You can't count on them being there.
* Moreover, you might need to interpret the types correctly.
*/
typedef uint32_t BAMOptDataValueType;
enum BAMOptDataValueTypes
{
dt_CSTRING = 'Z',
dt_INT8 = 'c',
dt_UINT8 = 'C',
dt_INT16 = 's',
dt_UINT16 = 'S',
dt_INT = 'i',
dt_UINT = 'I',
dt_FLOAT32 = 'f',
dt_FLOAT64 = 'd',
dt_ASCII = 'A',
dt_HEXSTRING = 'H',
dt_NUM_ARRAY = 'B'
};
#define OPT_TAG_X "X?" /* end user data */
#define OPT_TAG_Y "Y?" /* end user data */
#define OPT_TAG_Z "Z?" /* end user data */
#define OPT_TAG_ReadGroup "RG" /* Read Group; same as BAMAlignmentGetReadGroupName */
#define OPT_TAG_Library "LB" /* LIbrary; also BAMReadGroup */
#define OPT_TAG_Unit "PU" /* Platform specific Unit; also BAMReadGroup */
#define OPT_TAG_Program "PG" /* Alignment software name */
#define OPT_TAG_AlignScore "AS" /* Alignment Score (MapQuality?) */
#define OPT_TAG_SecQual "SQ" /* second called base:2 and quality:6; length == ReadLength? warning */
#define OPT_TAG_MateMapQual "MQ" /* map Quality of mate */
#define OPT_TAG_NumMismatch "NM" /* Number of Mismatches */
#define OPT_TAG_Hits0 "H0" /* Number of perfect hits */
#define OPT_TAG_Hits1 "H1" /* Number of off-by-one */
#define OPT_TAG_Hits2 "H2" /* Number of off-by-two */
#define OPT_TAG_CondQual "UQ" /* conditional Quality of read */
#define OPT_TAG_CondQPair "PQ" /* conditional Quality of pair */
#define OPT_TAG_ReadHits "NH" /* Number of times this read (spot) aligns */
#define OPT_TAG_ReadHits2 "IH" /* Number of times this read (spot) aligns that are in this file */
#define OPT_TAG_HitIndex "HI" /* n-th hit for this read in this file */
#define OPT_TAG_Match2 "MD" /* another sort of matching string like CIGAR but different? */
#define OPT_TAG_ColorKey "CS" /* primer and first color */
#define OPT_TAG_ColorQual "CQ" /* quality of above */
#define OPT_TAG_ColorMisses "CM" /* Number of color-space Mismatches */
#define OPT_TAG_SeqOverlap "GS"
#define OPT_TAG_QualOverlap "GQ"
#define OPT_TAG_OverlapDesc "GC"
#define OPT_TAG_MateSeq "R2" /* sequence of the mate */
#define OPT_TAG_MateQual "Q2" /* quality scores of the mate */
#define OPT_TAG_OtherQual "S2"
#define OPT_TAG_NextHitRef "CC" /* Reference name of the next hit */
#define OPT_TAG_NextHitPos "CP" /* coordinate of the next hit */
#define OPT_TAG_SingleMapQ "SM" /* quality of mapping as if not paired */
#define OPT_TAG_AM "AM"
#define OPT_TAG_MAQFlag "MQ"
struct BAMOptData
{
BAMOptDataValueType type;
uint32_t element_count;
union {
int8_t i8[8];
uint8_t u8[8];
int16_t i16[4];
uint16_t u16[4];
int32_t i32[2];
uint32_t u32[2];
int64_t i64[2];
uint64_t u64[2];
float f32[2];
double f64[1];
char asciiz[8];
} u;
};
typedef struct BAMOptData BAMOptData;
#ifndef USE_OLD_BAM_OPT_FOR_EACH
#define USE_OLD_BAM_OPT_FOR_EACH 0
#endif
#if USE_OLD_BAM_OPT_FOR_EACH
/* Optional data callback function */
typedef rc_t ( CC * BAMOptionalDataFunction )
( void *ctx, const char tag[2], BAMOptDataValueType type,
const void *value, uint32_t size );
ALIGN_EXTERN rc_t CC BAMAlignmentOptDataForEach
( const BAMAlignment *self, void *ctx, BAMOptionalDataFunction callback );
typedef rc_t ( CC * BAMOptionalDataFunction2 )
( void *ctx, const char tag[2], const BAMOptData *value );
ALIGN_EXTERN rc_t CC BAMAlignmentOptDataForEach2
( const BAMAlignment *self, void *ctx, BAMOptionalDataFunction2 callback );
#else
typedef rc_t ( CC * BAMOptionalDataFunction )
( void *ctx, const char tag[2], const BAMOptData *value );
ALIGN_EXTERN rc_t CC BAMAlignmentOptDataForEach
( const BAMAlignment *self, void *ctx, BAMOptionalDataFunction callback );
#endif
/*--------------------------------------------------------------------------
* BAMFile
*/
typedef struct BAMFile BAMFile;
typedef struct BAMRefSeq BAMRefSeq;
struct BAMRefSeq
{
uint64_t length;
const char *name; /* not null unique */
const char *assemblyId;
const uint8_t *checksum;
const char *uri;
const char *species;
uint32_t id;
uint8_t checksum_array[16];
};
typedef struct BAMReadGroup BAMReadGroup;
struct BAMReadGroup
{
const char *name; /* not null unique, accession e.g. SRR001138 */
const char *sample; /* not null */
const char *library;
const char *description;
const char *unit; /* platform specific identifier, e.g. BI.080214_SL-XAJ_0001_FC2044KAAXX.7 */
const char *insertSize;
const char *center; /* e.g. BI */
const char *runDate;
const char *platform; /* e.g. ILLUMINA */
uint32_t id;
};
/* 64-bit structure stored as an integer
* The high-order 48 bits store the position in the file at which a
* compressed block starts. The low-order 16 bits store the position
* in the decompressed block at which a record starts. This is the
* way that positions are represented in BAM indices.
*/
typedef uint64_t BAMFilePosition;
/* Make
* open the BAM file specified by path
*
* "path" [ IN ] - NUL terminated string or format
*/
ALIGN_EXTERN rc_t CC BAMFileMake ( const BAMFile **result, const char *path, ... );
/* MakeWithDir
* open the BAM file specified by path and supplied directory
*
* "dir" [ IN ] - directory object used to open file
*
* "path" [ IN ] - NUL terminated string or format
*/
ALIGN_EXTERN rc_t CC BAMFileMakeWithDir ( const BAMFile **result,
struct KDirectory const *dir, const char *path, ... );
ALIGN_EXTERN rc_t CC BAMFileVMakeWithDir ( const BAMFile **result,
struct KDirectory const *dir, const char *path, va_list args );
/* Make
* open the BAM file specified by file
*
* "file" [ IN ] - an open KFile
*/
ALIGN_EXTERN rc_t CC BAMFileMakeWithKFile(const BAMFile **result,
struct KFile const *file);
/* Make
* open the BAM file specified by file
*
* "file" [ IN ] - an open KFile
*/
ALIGN_EXTERN rc_t CC BAMFileMakeWithKPath(const BAMFile **result,
struct KPath const *path);
/* ExportBAMFile
* export the BAMFile object in use by the AlignAccessDB, if any
* must be released via BAMFileRelease
*/
ALIGN_EXTERN rc_t CC AlignAccessDBExportBAMFile ( struct AlignAccessDB const *self,
const BAMFile **result );
/* AddRef
* Release
*/
ALIGN_EXTERN rc_t CC BAMFileAddRef ( const BAMFile *self );
ALIGN_EXTERN rc_t CC BAMFileRelease ( const BAMFile *self );
/* GetPosition
* get the position of the about-to-be read alignment
* this position can be stored
* this position can be passed into SetPosition to seek to the same alignment
*
* "pos" [ OUT ] - return parameter for position
*/
ALIGN_EXTERN rc_t CC BAMFileGetPosition ( const BAMFile *self, BAMFilePosition *pos );
/* GetProportionalPosition
* get the aproximate proportional position in the input file
* this is intended to be useful for computing progress
*
* NB - does not return rc_t
*/
ALIGN_EXTERN float CC BAMFileGetProportionalPosition ( const BAMFile *self );
/* Read
* read an aligment
*
* "result" [ OUT ] - return param for BAMAlignment object
* must be released with BAMAlignmentRelease
*
* returns RC(..., ..., ..., rcRow, rcNotFound) at end
*/
ALIGN_EXTERN rc_t CC BAMFileRead ( const BAMFile *self, const BAMAlignment **result );
/* Rewind
* reset the position back to the first aligment in the file
*/
ALIGN_EXTERN rc_t CC BAMFileRewind ( const BAMFile *self );
/* SetPosition
* set the position to a particular alignment
* pass in the values from GetPosition
*/
ALIGN_EXTERN rc_t CC BAMFileSetPosition ( const BAMFile *self, const BAMFilePosition *pos );
/* GetRefSeqCount
* get the number of Reference Sequences refered to in the header
* this is not necessarily the number of Reference Sequences referenced
* by the alignments
*/
ALIGN_EXTERN rc_t CC BAMFileGetRefSeqCount ( const BAMFile *self, uint32_t *count );
/* GetRefSeq
* get the n'th Ref. Seq. where n is [0..RefSeqCount)
* the resulting pointer is static-like; it is freed when the BAMFile is.
* IOW, it is good for precisely at long as the BAMFile is.
*/
ALIGN_EXTERN rc_t CC BAMFileGetRefSeq ( const BAMFile *self, uint32_t n, const BAMRefSeq **result );
/* GetRefSeqById
* get a Ref. Seq. by its id
* the resulting pointer is static-like; it is freed when the BAMFile is.
* IOW, it is good for precisely at long as the BAMFile is.
*/
ALIGN_EXTERN rc_t CC BAMFileGetRefSeqById ( const BAMFile *self, int32_t id, const BAMRefSeq **result );
/* GetReadGroupCount
* get the number of Read Groups (accessions, etc.) refered to in the header
* this is not necessarily the number of Read Groups referenced
* by the alignments
*/
ALIGN_EXTERN rc_t CC BAMFileGetReadGroupCount ( const BAMFile *self, uint32_t *count );
/* GetReadGroup
* get the n'th Read Group where n is [0..ReadGroupCount)
* the resulting pointer is static-like; it is freed when the BAMFile is.
* IOW, it is good for precisely at long as the BAMFile is.
*/
ALIGN_EXTERN rc_t CC BAMFileGetReadGroup ( const BAMFile *self, unsigned n, const BAMReadGroup **result );
/* GetHeaderText
* get the text of the BAM header file
* the resulting pointer is static-like; it is freed when the BAMFile is.
* IOW, it is good for precisely at long as the BAMFile is.
*/
ALIGN_EXTERN rc_t CC BAMFileGetHeaderText(BAMFile const *cself, char const **header, size_t *header_len);
/* GetReadGroupByName
* get a Read Group by its name
* the resulting pointer is static-like; it is freed when the BAMFile is.
* IOW, it is good for precisely at long as the BAMFile is.
*/
ALIGN_EXTERN rc_t CC BAMFileGetReadGroupByName ( const BAMFile *self,
const char *name, const BAMReadGroup **result );
/* OpenIndex
* takes a simple path...
*/
ALIGN_EXTERN rc_t CC BAMFileOpenIndex ( const BAMFile *self, const char *path );
ALIGN_EXTERN rc_t CC BAMFileOpenIndexWithKPath ( const BAMFile *self, struct KPath const *path );
/* IsIndexed
* returns true if true
*/
ALIGN_EXTERN bool CC BAMFileIsIndexed ( const BAMFile *self );
/* IndexHasRefSeqId
*/
ALIGN_EXTERN bool CC BAMFileIndexHasRefSeqId ( const BAMFile *self, uint32_t refSeqId );
/* Seek
* seeks a half-open zero-based interval on a particular reference
* rcSelf, rcIncomplete
*/
ALIGN_EXTERN rc_t CC BAMFileSeek ( const BAMFile *self, uint32_t refSeqId, uint64_t alignStart, uint64_t alignEnd );
typedef uint32_t BAMValidateOption;
enum BAMValidateOptions {
/* this is the minimum level of BAM file validation; just walks the compressed block headers */
bvo_BlockHeaders = 1,
/* decompresses each block */
bvo_BlockCompression = 2,
/* within each block, walks the records without examining the contents */
bvo_BlockStructure = 3,
/* within each record, validate the structure vis-a-vis the record size */
bvo_RecordStructure = 4,
/* verify that the extra fields a parsable */
bvo_ExtraFields = 8,
/* confirm that no alignment starts before the alignment preceeding it */
bvo_Sorted = 16,
/* verify that flags are consistent with itself and the other fields in the record
* NB. can not verify secondary alignment flag 0x100
*/
bvo_FlagsConsistency = 32,
/* verify CIGAR against sequence length */
bvo_CIGARConsistency = 64,
/* verify that bin number corresponds to position and alignment length */
bvo_BinConsistency = 128,
/* verify that mapQ is consistent with flags and refSeqID */
bvo_MapQuality = 256,
/* verify Quality values >= 33 */
bvo_QualityValues = 512,
/* verify that sequence length != 0 */
bvo_MissingSequence = 1024,
/* verify that Quality values != 255 */
bvo_MissingQuality = 2048,
/* compute flagstats */
bvo_FlagsStats = 4096,
/* verify that index is parsable
* NB. this can be done without a BAM file
*/
bvo_IndexStructure = 1 << 16,
/* verify that the file offsets in the index are valid for the given BAM file
* NB. does not cause decompression of the BAM file but will cause referenced
* block headers to be validated
*/
bvo_IndexOffsets1 = 2 << 16,
/* in addition to verifying that the file offsets in the index are valid for
* the given BAM file, verify that the record offsets with the blocks are valid.
* NB. will cause referenced blocks to be decompressed and structurally validated.
*/
bvo_IndexOffsets2 = 3 << 16,
/* verify that index's reference number and bin number agree with the
* referenced record
*/
bvo_IndexBins = 4 << 16,
bvo_IndexOptions = 7 << 16
};
typedef struct BAMValidateStats BAMValidateStats;
typedef struct BAMValidateStatsRow BAMValidateStatsRow;
struct BAMValidateStatsRow {
uint64_t good;
uint64_t warning;
uint64_t error;
};
struct BAMValidateStats {
uint64_t bamFileSize;
uint64_t bamFilePosition;
uint64_t baiFileSize;
uint64_t baiFilePosition;
BAMValidateStatsRow blockHeaders;
BAMValidateStatsRow blockCompression;
BAMValidateStatsRow blockStructure;
BAMValidateStatsRow recordStructure;
BAMValidateStatsRow extraFields;
BAMValidateStatsRow inOrder;
BAMValidateStatsRow flags[16];
BAMValidateStatsRow CIGAR;
BAMValidateStatsRow bin;
BAMValidateStatsRow quality;
BAMValidateStatsRow hasSequence;
BAMValidateStatsRow hasQuality;
BAMValidateStatsRow indexFileOffset;
BAMValidateStatsRow indexBlockOffset;
BAMValidateStatsRow indexBin;
bool bamHeaderIsGood;
bool bamHeaderIsBad;
bool indexStructureIsGood;
bool indexStructureIsBad;
};
typedef rc_t (CC *BAMValidateCallback)(void *ctx, rc_t result, const BAMValidateStats *stats);
/* Validate
*/
ALIGN_EXTERN rc_t CC BAMValidate ( struct KPath const *bam,
struct KPath const *bai,
BAMValidateOption options,
BAMValidateCallback callback,
void *callbackContext
);
#ifdef __cplusplus
}
#endif
#endif /* _h_align_bam_ */
sra_sdk-2.1.7/interfaces/align/refseq-mgr.h 0000664 0012213 0011620 00000006346 11645077605 020317 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was readten as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_align_refseq_mgr_
#define _h_align_refseq_mgr_
#ifndef _h_align_extern_
#include
#endif
#include
#include
#include
#ifdef __cplusplus
extern "C" {
#endif
typedef struct RefSeqMgr RefSeqMgr;
/* Manages refseq tables
reader_options [IN] - passed to TableReaderRefSeq
cache [IN] - db cache size per single!!! reference (vdb cursor cache)
keep_open_num [IN] - number of refseq kept open, 0 - no limit
*/
ALIGN_EXTERN rc_t CC RefSeqMgr_Make(const RefSeqMgr** cself, const VDBManager* vmgr,
uint32_t reader_options, size_t cache, uint32_t keep_open_num);
ALIGN_EXTERN rc_t CC RefSeqMgr_Release(const RefSeqMgr* cself);
/* return value if 0 means object was found */
ALIGN_EXTERN rc_t RefSeqMgr_Exists(const RefSeqMgr* cself, const char* accession, uint32_t accession_sz);
/* Read from refseq ided by seq_id chunk of 'len' bases into provided 'buffer' (must be enough big for len);
on return written has number of bases written
*/
ALIGN_EXTERN rc_t CC RefSeqMgr_Read(const RefSeqMgr* cself, const char* seq_id, uint32_t seq_id_sz,
int64_t offset, INSDC_coord_len len,
INSDC_dna_text* buffer, INSDC_coord_len* written);
typedef struct RefSeq RefSeq;
ALIGN_EXTERN rc_t CC RefSeqMgr_GetSeq(const RefSeqMgr* cmgr, const RefSeq** cself, const char* seq_id, uint32_t seq_id_sz);
/* Same as RefSeqMgr_Read
*/
ALIGN_EXTERN rc_t CC RefSeq_Read(const RefSeq* cself, int64_t offset, INSDC_coord_len len,
INSDC_dna_text* buffer, INSDC_coord_len* written);
ALIGN_EXTERN rc_t CC RefSeq_Circular(const RefSeq* cself, bool* circular);
ALIGN_EXTERN rc_t CC RefSeq_SeqLength(const RefSeq* cself, uint64_t* len);
ALIGN_EXTERN rc_t CC RefSeq_MD5(const RefSeq* cself, const uint8_t** md5);
ALIGN_EXTERN rc_t CC RefSeq_Release(const RefSeq* cself);
#ifdef __cplusplus
}
#endif
#endif /* _h_align_refseq_mgr_ */
sra_sdk-2.1.7/interfaces/align/reader-refseq.h 0000664 0012213 0011620 00000005550 11645077605 020770 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was readten as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_align_reader_refseq_
#define _h_align_reader_refseq_
#ifndef _h_align_extern_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
enum ETableReaderRefSeq_Options {
errefseq_4NA = 0x01 /* read in INSDC:4na:bin, INSDC:dna:text is default */
};
typedef struct TableReaderRefSeq TableReaderRefSeq;
ALIGN_EXTERN rc_t CC TableReaderRefSeq_MakeTable(const TableReaderRefSeq** cself, const VDBManager* vmgr,
const VTable* table, uint32_t options, size_t cache);
ALIGN_EXTERN rc_t CC TableReaderRefSeq_MakePath(const TableReaderRefSeq** cself, const VDBManager* vmgr,
const char* path, uint32_t options, size_t cache);
ALIGN_EXTERN void CC TableReaderRefSeq_Whack(const TableReaderRefSeq* cself);
ALIGN_EXTERN rc_t CC TableReaderRefSeq_SeqId(const TableReaderRefSeq* cself, const char** id, uint32_t* id_sz);
ALIGN_EXTERN rc_t CC TableReaderRefSeq_SeqLength(const TableReaderRefSeq* cself, uint64_t* len);
ALIGN_EXTERN rc_t CC TableReaderRefSeq_Circular(const TableReaderRefSeq* cself, bool* circular);
/* *md5 is NULL if not present */
ALIGN_EXTERN rc_t CC TableReaderRefSeq_MD5(const TableReaderRefSeq* cself, const uint8_t** md5);
/* read a chunk of refseq into buffer from offset up to offset + len
if offset is beyond non-circular refseq size error is returned
*/
ALIGN_EXTERN rc_t CC TableReaderRefSeq_Read(const TableReaderRefSeq* cself, int64_t offset, INSDC_coord_len len,
INSDC_dna_text* buffer, INSDC_coord_len* written);
#ifdef __cplusplus
}
#endif
#endif /* _h_align_reader_refseq_ */
sra_sdk-2.1.7/interfaces/align/writer-reference.h 0000664 0012213 0011620 00000011632 11645077605 021511 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_align_writer_reference_
#define _h_align_writer_reference_
#ifndef _h_align_extern_
#include
#endif
#include
#include
#include
#include
#ifdef __cplusplus
extern "C" {
#endif
enum EReference_Options {
ewrefmgr_co_allREADs = 0x01, /* always write READ */
ewrefmgr_co_Coverage = 0x02 /* use coverage data, by default not used */
};
typedef struct ReferenceMgr ReferenceMgr;
/* Writes REFERENCE table with in given db
vmgr [IN] - needed only if conf is not NULL
conf [IN] - optional path to tab separated file to resolve reference names
from source files to standard refseq accessions;
standard refseq dictionary location is obtained from kfg files.
path {IN] - optional path points to a directory with 'local' references
(not found in conf file), default is '.'
max_seq_len [IN] - 0 - use default
cache [IN] - db cache size per single!!! reference (vdb cursor cache)
num_open [IN] - number of refseq kept open, 0 - no limit
*/
ALIGN_EXTERN rc_t CC ReferenceMgr_Make(const ReferenceMgr** cself, VDatabase* db, const VDBManager* vmgr,
const uint32_t options, const char* conf, const char* path, uint32_t max_seq_len,
size_t cache, uint32_t num_open);
ALIGN_EXTERN rc_t CC ReferenceMgr_Release(const ReferenceMgr* cself, bool commit, uint64_t* rows, bool build_coverage);
typedef struct ReferenceSeq ReferenceSeq;
/* id: chr12 or NC_000001.3 */
ALIGN_EXTERN rc_t CC ReferenceMgr_GetSeq(const ReferenceMgr* cself, const ReferenceSeq** seq, const char* id);
ALIGN_EXTERN rc_t CC ReferenceMgr_Verify(const ReferenceMgr* cself, const char* id, uint64_t length, const uint8_t md5[16]);
enum EReference_CompressionOptions {
ewrefmgr_cmp_Binary = 0x01, /* binary cigar on input (BAM format: 28+4 bits) */
ewrefmgr_cmp_NoMismatch = 0x02 /* do not fill out MISMATCH data */
};
ALIGN_EXTERN rc_t CC ReferenceMgr_Compress(const ReferenceMgr* cself, uint32_t options,
const char* id, int64_t offset,
const char* seq, INSDC_coord_len seq_len,
const void* cigar, uint32_t cigar_len,
TableWriterAlgnData* data);
/* Read refseq chunk of 'len' bases into provided 'buffer' (must be enough big for len);
ref_len - on return has number of bases written to the buffer
*/
ALIGN_EXTERN rc_t CC ReferenceSeq_Read(const ReferenceSeq* cself, int64_t offset, INSDC_coord_len len,
INSDC_dna_text* buffer, INSDC_coord_len* ref_len);
ALIGN_EXTERN rc_t CC ReferenceSeq_Get1stRow(const ReferenceSeq* cself, int64_t* row_id);
ALIGN_EXTERN rc_t CC ReferenceSeq_Compress(const ReferenceSeq* cself, uint32_t options,
int64_t offset,
const char* seq, INSDC_coord_len seq_len,
const void* cigar, uint32_t cigar_len,
TableWriterAlgnData* data);
typedef struct ReferenceSeqCoverage_struct {
uint8_t high;
uint8_t low;
uint32_t mismatches;
uint32_t indels;
TableWriterData primary_ids;
TableWriterData secondary_ids;
} ReferenceSeqCoverage;
ALIGN_EXTERN rc_t CC ReferenceSeq_AddCoverage(const ReferenceSeq* cself, int64_t offset, const ReferenceSeqCoverage* data);
ALIGN_EXTERN rc_t CC ReferenceSeq_Release(const ReferenceSeq* cself);
#ifdef __cplusplus
}
#endif
#endif /* _h_align_writer_reference_ */
sra_sdk-2.1.7/interfaces/align/writer-cmn.h 0000664 0012213 0011620 00000003066 11613567441 020327 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_align_writer_cmn_
#define _h_align_writer_cmn_
#ifndef _h_align_extern_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct TableWriterData_struct {
const void* buffer;
uint64_t elements;
} TableWriterData;
#ifdef __cplusplus
}
#endif
#endif /* _h_align_writer_cmn_ */
sra_sdk-2.1.7/interfaces/align/writer-refseq.h 0000664 0012213 0011620 00000006127 11613570452 021034 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_align_writer_refseq_
#define _h_align_writer_refseq_
#ifndef _h_align_extern_
#include
#endif
#include
#include
#ifdef __cplusplus
extern "C" {
#endif
/* default sequence chunk length */
#define TableWriterRefSeq_MAX_SEQ_LEN 5000
/* use in TableWriterRefSeq_Write* methods */
enum ETableWriterRefSeq_ColNames {
ewrefseq_cn_MAX_SEQ_LEN, /* static/default */
ewrefseq_cn_DEF_LINE, /* static/default */
ewrefseq_cn_CS_KEY, /* handled by writer */
ewrefseq_cn_READ,
ewrefseq_cn_QUALITY, /* optional */
ewrefseq_cn_SEQ_ID, /* static/default */
ewrefseq_cn_SEQ_START, /* calculated on fly by writer */
ewrefseq_cn_SEQ_LEN, /* calculated on fly by writer */
ewrefseq_cn_CIRCULAR, /* static/default */
ewrefseq_cn_Last = ewrefseq_cn_CIRCULAR
};
enum ETableWriterRefSeq_ColOptions {
ewrefseq_co_QUALITY = 0x01 /* use QUALITY column, by default not opened */
};
typedef struct TableWriterRefSeqData_struct {
TableWriterData read;
TableWriterData quality;
} TableWriterRefSeqData;
typedef struct TableWriterRefSeq TableWriterRefSeq;
ALIGN_EXTERN rc_t CC TableWriterRefSeq_Make(const TableWriterRefSeq** cself, VDBManager* mgr, const char* schema_path,
const char* table_path, const uint32_t options);
/* rows optional here */
ALIGN_EXTERN rc_t CC TableWriterRefSeq_Whack(const TableWriterRefSeq* cself, bool commit, uint64_t* rows);
ALIGN_EXTERN rc_t CC TableWriterRefSeq_WriteDefault(const TableWriterRefSeq* cself,
enum ETableWriterRefSeq_ColNames col, const TableWriterData* data);
/* rowid optional here */
ALIGN_EXTERN rc_t CC TableWriterRefSeq_Write(const TableWriterRefSeq* cself, const TableWriterRefSeqData* data, int64_t* rowid);
#ifdef __cplusplus
}
#endif
#endif /* _h_align_writer_refseq_ */
sra_sdk-2.1.7/interfaces/align/writer-alignment.h 0000664 0012213 0011620 00000012565 11645077605 021537 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_align_writer_alignment_
#define _h_align_writer_alignment_
#ifndef _h_align_extern_
#include
#endif
#include
#ifdef __cplusplus
extern "C" {
#endif
enum ETableWriterAlgn_ColNames {
ewalgn_cn_TMP_KEY_ID,
ewalgn_cn_PLOIDY,
ewalgn_cn_SEQ_SPOT_ID,
ewalgn_cn_SEQ_READ_ID,
ewalgn_cn_READ_START,
ewalgn_cn_READ_LEN,
ewalgn_cn_REF_ID,
ewalgn_cn_REF_START,
ewalgn_cn_GLOBAL_REF_START,
ewalgn_cn_REF_LEN,
ewalgn_cn_REF_ORIENTATION,
ewalgn_cn_REF_PLOIDY,
ewalgn_cn_MATE_REF_ORIENTATION,
ewalgn_cn_MATE_REF_ID,
ewalgn_cn_MATE_REF_POS,
ewalgn_cn_MATE_ALIGN_ID,
ewalgn_cn_TEMPLATE_LEN,
ewalgn_cn_MAPQ,
ewalgn_cn_HAS_MISMATCH,
ewalgn_cn_HAS_REF_OFFSET,
ewalgn_cn_MISMATCH,
ewalgn_cn_REF_OFFSET,
ewalgn_cn_Last = ewalgn_cn_REF_OFFSET
};
typedef uint8_t ETableWriterAlgn_TableType;
enum {
ewalgn_tabletype_PrimaryAlignment,
ewalgn_tabletype_SecondaryAlignment,
ewalgn_tabletype_EvidenceInterval,
ewalgn_tabletype_EvidenceAlignment
};
enum ETableWriterAlgn_ColOptions {
ewalgn_co_SEQ_SPOT_ID = 0x01, /* SEQ_SPOT_ID will be written with the whole record */
ewalgn_co_TMP_KEY_ID = 0x02, /* use TMP_KEY_ID column, by default not opened */
ewalgn_co_PLOIDY = 0x04, /* ploidy is more than 1, columns PLOIDY, READ_START, READ_LEN needs data */
ewalgn_co_unsorted = 0x08 /* use the unsorted table scheme */
};
typedef struct TableWriterAlgnData_struct {
TableWriterData seq_spot_id;
TableWriterData seq_read_id;
TableWriterData tmp_key_id;
/* filled out by ReferenceMgr_Compress */
uint32_t ploidy; /* incremented sequentially for each call, set it to 0 for each new spot */
TableWriterData read_start;
TableWriterData read_len;
TableWriterData has_ref_offset;
TableWriterData ref_offset;
TableWriterData ref_id; /* unsorted */
TableWriterData ref_start; /* unsorted */
TableWriterData global_ref_start; /* sorted */
/* not used for secondary and evidence alignment table type */
TableWriterData has_mismatch;
TableWriterData mismatch;
/* tmp data, never saved to db */
TableWriterData effective_offset; /* recalculated based on CIGAR and circularity in Compression */
TableWriterData ref_len;
TableWriterData ref_1st_row_id;
/* filled out by ReferenceMgr_Compress end */
TableWriterData ref_orientation;
TableWriterData ref_ploidy;
TableWriterData mapq;
/* used only only in secondary */
TableWriterData mate_ref_orientation;
TableWriterData mate_ref_id;
TableWriterData mate_ref_pos;
TableWriterData mate_align_id;
TableWriterData template_len;
} TableWriterAlgnData;
typedef struct TableWriterAlgn TableWriterAlgn;
ALIGN_EXTERN rc_t CC TableWriterAlgn_Make(const TableWriterAlgn** cself, VDatabase* db,
ETableWriterAlgn_TableType type, uint32_t options);
/* rows optional here */
ALIGN_EXTERN rc_t CC TableWriterAlgn_Whack(const TableWriterAlgn* cself, bool commit, uint64_t* rows);
ALIGN_EXTERN rc_t CC TableWriterAlgn_WriteDefault(const TableWriterAlgn* cself,
enum ETableWriterAlgn_ColNames col, const TableWriterData* data);
ALIGN_EXTERN rc_t CC TableWriterAlgn_GetNextRowId(const TableWriterAlgn* cself, int64_t* rowid);
/* rowid optional here */
ALIGN_EXTERN rc_t CC TableWriterAlgn_Write(const TableWriterAlgn* cself, const TableWriterAlgnData* data, int64_t* rowid);
/* closes main cursor and creates lookup object on the successfully committed main cursor */
ALIGN_EXTERN rc_t CC TableWriterAlgn_TmpKeyStart(const TableWriterAlgn* cself);
/* retrieve TMP_KEY value by rowid */
ALIGN_EXTERN rc_t CC TableWriterAlgn_TmpKey(const TableWriterAlgn* cself, int64_t rowid, uint32_t* key_id);
/* assign a SPOT_ID value to row */
ALIGN_EXTERN rc_t CC TableWriterAlgn_Write_SpotId(const TableWriterAlgn* cself, int64_t rowid, int64_t spot_id);
/* utillity function */
ALIGN_EXTERN rc_t CC TableWriterAlgn_ReverseCompliment(const INSDC_dna_text* seq, INSDC_dna_text* cmpl, uint32_t len);
#ifdef __cplusplus
}
#endif
#endif /* _h_align_writer_alignment_ */
sra_sdk-2.1.7/interfaces/align/writer-sequence.h 0000664 0012213 0011620 00000012647 11645077605 021372 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_align_writer_sequence_
#define _h_align_writer_sequence_
#ifndef _h_align_extern_
#include
#endif
#include
#ifdef __cplusplus
extern "C" {
#endif
enum ETableWriterSeq_ColNames {
ewseq_cn_READ,
ewseq_cn_CSREAD,
ewseq_cn_CSKEY,
ewseq_cn_QUALITY,
ewseq_cn_PRIMARY_ALIGNMENT_ID,
ewseq_cn_ALIGNMENT_COUNT,
ewseq_cn_PLATFORM,
ewseq_cn_LABEL,
ewseq_cn_LABEL_START,
ewseq_cn_LABEL_LEN,
ewseq_cn_READ_TYPE,
ewseq_cn_READ_START,
ewseq_cn_READ_LEN,
ewseq_cn_TMP_KEY_ID,
ewseq_cn_SPOT_GROUP,
ewseq_cn_READ_FILTER,
ewseq_cn_Last = ewseq_cn_READ_FILTER
};
enum ETableWriterSeq_ColOptions {
ewseq_co_SaveRead = 0x01, /* write read even when there are alignments */
ewseq_co_FullQuality = 0x02, /* write full quality values, by default [1,10,20,30] */
ewseq_co_AlignData = 0x04, /* PRIMARY_ALIGNMENT_ID, ALIGNMENT_COUNT will be written with the whole record */
ewseq_co_NoLabelData = 0x08, /* LABEL and related columns will not be written */
ewseq_co_ColorSpace = 0x10, /* CMP_CSREAD will be written instead of CMP_READ */
ewseq_co_SpotGroup = 0x20 /* SPOT_GROUP will be written */
};
typedef struct TableWriterSeqData_struct {
TableWriterData sequence; /* writes sequence ONLY if alignment_count == 0 */
TableWriterData quality;
TableWriterData primary_alignment_id;
TableWriterData alignment_count;
TableWriterData label;
TableWriterData label_start;
TableWriterData label_len;
uint8_t nreads;
TableWriterData read_type;
TableWriterData read_start;
TableWriterData read_len;
uint32_t tmp_key_id;
TableWriterData spot_group;
TableWriterData cskey;
TableWriterData read_filter;
} TableWriterSeqData;
typedef struct TableWriterSeq TableWriterSeq;
/*
* quality_quantization:
* is a ',' seperated list of value pairs, with the pairs seperated by ':'.
* The first of the pair is the value to substitute.
* The second is the limit at which the substitution is no longer valid.
* The second value can be '-' to indication the remainder; this also terminates
* processing of the string. If the second value is not '-', then the trailing
* ',' is required.
*
* Example: 1:10,10:20,20:30,30:40,
* This will substitute 1 for quality values [0, 10), 10 for [10, 20),
* 20 for [20, 30), 30 for [30, 40), and 0 for the rest
*
* Example: 1:10,10:20,20:30,30:-
* This will substitute 1 for quality values [0, 10), 10 for [10, 20),
* 20 for [20, 30), and 30 for the rest
*
* Example: 1:30,30:-
* This will substitute 1 for quality values [0, 30), and 30 for the rest
*
* Example: 10:30,20:-
* This will substitute 10 for quality values [0, 30), 20 for the rest
*/
ALIGN_EXTERN rc_t CC TableWriterSeq_Make(const TableWriterSeq** cself, VDatabase* db,
const uint32_t options, char const quality_quantization[]);
/* rows optional here */
ALIGN_EXTERN rc_t CC TableWriterSeq_Whack(const TableWriterSeq* cself, bool commit, uint64_t* rows);
ALIGN_EXTERN rc_t CC TableWriteSeq_WriteDefault(const TableWriterSeq* cself,
enum ETableWriterSeq_ColNames col, const TableWriterData* data);
ALIGN_EXTERN rc_t CC TableWriterSeq_GetNextRowId(const TableWriterSeq* cself, int64_t* rowid);
/* rowid optional here */
ALIGN_EXTERN rc_t CC TableWriterSeq_Write(const TableWriterSeq* cself, const TableWriterSeqData* data, int64_t* rowid);
/* if option ewseq_co_AlignData is not set (default) below methods are available */
/* closes main cursor and creates lookup object on the successfully committed main cursor */
ALIGN_EXTERN rc_t CC TableWriterSeq_TmpKeyStart(const TableWriterSeq* cself);
/* retrieve TMP_KEY value by rowid */
ALIGN_EXTERN rc_t CC TableWriterSeq_TmpKey(const TableWriterSeq* cself, int64_t rowid, uint32_t *key_id);
ALIGN_EXTERN rc_t CC TableWriterSeq_WriteAlignmentData(const TableWriterSeq* cself, int64_t rowid,
const TableWriterData* primary_alignment_id,
const TableWriterData* alignment_count);
#ifdef __cplusplus
}
#endif
#endif /* _h_align_writer_sequence_ */
sra_sdk-2.1.7/interfaces/cc/ 0000755 0012213 0011620 00000000000 11477730356 015360 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/cc/gcc/ 0000755 0012213 0011620 00000000000 11477730356 016114 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/cc/gcc/compiler.h 0000644 0012213 0011620 00000002542 11476747550 020105 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_compiler_
#define _h_compiler_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* _h_compiler_ */
sra_sdk-2.1.7/interfaces/cc/gcc/va_copy.h 0000644 0012213 0011620 00000003267 11476747550 017740 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_va_copy_
#define _h_va_copy_
/* GCC may internally undef 'va_copy' upon include of stdarg.h
force it to be included before defining va_copy */
#include
#ifdef __cplusplus
extern "C" {
#endif
/* kludge - GCC stdarg has this line:
#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L
fix build for c99 */
#if ! defined va_copy && defined __va_copy
#define va_copy __va_copy
#endif
#ifdef __cplusplus
}
#endif
#endif /* _h_va_copy_ */
sra_sdk-2.1.7/interfaces/cc/gcc/i386/ 0000755 0012213 0011620 00000000000 11477730356 016605 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/cc/gcc/i386/arch-impl.h 0000644 0012213 0011620 00000020351 11476747550 020636 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_arch_impl_
#define _h_arch_impl_
#include
#ifdef __cplusplus
extern "C" {
#endif
static __inline__
int16_t uint16_lsbit ( uint16_t self )
{
int16_t rtn;
__asm__ __volatile__
(
"bsf %%ax, %%ax;"
"jnz .+5;"
"xor %%eax, %%eax;"
"dec %%eax;"
: "=a" ( rtn )
: "a" ( self )
);
return rtn;
}
static __inline__
int32_t uint32_lsbit ( uint32_t self )
{
int32_t rtn;
__asm__ __volatile__
(
"bsf %%eax, %%eax;"
"jnz .+5;"
"xor %%eax, %%eax;"
"dec %%eax;"
: "=a" ( rtn )
: "a" ( self )
);
return rtn;
}
typedef struct int128_t int128_t;
struct int128_t
{
uint64_t lo;
int64_t hi;
};
static __inline__
int64_t int128_hi ( const int128_t *self )
{
return self -> hi;
}
static __inline__
uint64_t int128_lo ( const int128_t *self )
{
return self -> lo;
}
static __inline__
void int128_sethi ( int128_t *self, int64_t i )
{
self -> hi = i;
}
static __inline__
void int128_setlo ( int128_t *self, uint64_t i )
{
self -> lo = i;
}
typedef struct uint128_t uint128_t;
struct uint128_t
{
uint64_t lo;
uint64_t hi;
};
static __inline__
uint64_t uint128_hi ( const uint128_t *self )
{
return self -> hi;
}
static __inline__
uint64_t uint128_lo ( const uint128_t *self )
{
return self -> lo;
}
static __inline__
void uint128_sethi ( uint128_t *self, uint64_t i )
{
self -> hi = i;
}
static __inline__
void uint128_setlo ( uint128_t *self, uint64_t i )
{
self -> lo = i;
}
static __inline__
void int128_add ( int128_t *self, const int128_t *i )
{
__asm__ __volatile__
(
"push %%ebx;"
"mov (%%edx), %%eax;"
"mov 4(%%edx), %%ebx;"
"mov 8(%%edx), %%esi;"
"mov 12(%%edx), %%edi;"
"add %%eax, (%%ecx);"
"adc %%ebx, 4(%%ecx);"
"adc %%esi, 8(%%ecx);"
"adc %%edi, 12(%%ecx);"
"pop %%ebx;"
:
: "c" ( self ), "d" ( i )
: "%eax", "%esi", "%edi"
);
}
static __inline__
void int128_sub ( int128_t *self, const int128_t *i )
{
__asm__ __volatile__
(
"push %%ebx;"
"mov (%%edx), %%eax;"
"mov 4(%%edx), %%ebx;"
"mov 8(%%edx), %%esi;"
"mov 12(%%edx), %%edi;"
"sub %%eax, (%%ecx);"
"sbb %%ebx, 4(%%ecx);"
"sbb %%esi, 8(%%ecx);"
"sbb %%edi, 12(%%ecx);"
"pop %%ebx;"
:
: "c" ( self ), "d" ( i )
: "%eax", "%esi", "%edi"
);
}
static __inline__
void int128_sar ( int128_t *self, uint32_t i )
{
__asm__ __volatile__
(
"mov 4(%%edx), %%eax;"
"shrd %%cl, %%eax, (%%edx);"
"mov 8(%%edx), %%eax;"
"shrd %%cl, %%eax, 4(%%edx);"
"mov 12(%%edx), %%eax;"
"shrd %%cl, %%eax, 8(%%edx);"
"sar %%cl, %%eax;"
"mov %%eax, 12(%%edx);"
:
: "d" ( self ), "c" ( i )
: "%eax"
);
}
static __inline__
void int128_shl ( int128_t *self, uint32_t i )
{
__asm__ __volatile__
(
"mov 8(%%edx), %%eax;"
"shld %%cl, %%eax, 12(%%edx);"
"mov 4(%%edx), %%eax;"
"shld %%cl, %%eax, 8(%%edx);"
"mov (%%edx), %%eax;"
"shld %%cl, %%eax, 4(%%edx);"
"shl %%cl, %%eax;"
"mov %%eax, (%%edx);"
:
: "d" ( self ), "c" ( i )
: "%eax"
);
}
static __inline__
void uint128_and ( uint128_t *self, const uint128_t *i )
{
__asm__ __volatile__
(
"push %%ebx;"
"mov (%%edx), %%eax;"
"mov 4(%%edx), %%ebx;"
"mov 8(%%edx), %%esi;"
"mov 12(%%edx), %%edi;"
"and %%eax, (%%ecx);"
"and %%ebx, 4(%%ecx);"
"and %%esi, 8(%%ecx);"
"and %%edi, 12(%%ecx);"
"pop %%ebx;"
:
: "c" ( self ), "d" ( i )
: "%eax", "%esi", "%edi"
);
}
static __inline__
void uint128_or ( uint128_t *self, const uint128_t *i )
{
__asm__ __volatile__
(
"push %%ebx;"
"mov (%%edx), %%eax;"
"mov 4(%%edx), %%ebx;"
"mov 8(%%edx), %%esi;"
"mov 12(%%edx), %%edi;"
"or %%eax, (%%ecx);"
"or %%ebx, 4(%%ecx);"
"or %%esi, 8(%%ecx);"
"or %%edi, 12(%%ecx);"
"pop %%ebx;"
:
: "c" ( self ), "d" ( i )
: "%eax", "%esi", "%edi"
);
}
static __inline__
void uint128_orlo ( uint128_t *self, uint64_t i )
{
self -> lo |= i;
}
static __inline__
void uint128_xor ( uint128_t *self, const uint128_t *i )
{
__asm__ __volatile__
(
"push %%ebx;"
"mov (%%edx), %%eax;"
"mov 4(%%edx), %%ebx;"
"mov 8(%%edx), %%esi;"
"mov 12(%%edx), %%edi;"
"xor %%eax, (%%ecx);"
"xor %%ebx, 4(%%ecx);"
"xor %%esi, 8(%%ecx);"
"xor %%edi, 12(%%ecx);"
"pop %%ebx;"
:
: "c" ( self ), "d" ( i )
: "%eax", "%esi", "%edi"
);
}
static __inline__
void uint128_not ( uint128_t *self )
{
__asm__ __volatile__
(
"notl (%%ecx);"
"notl 4(%%ecx);"
"notl 8(%%ecx);"
"notl 12(%%ecx);"
:
: "c" ( self )
);
}
static __inline__
void uint128_shr ( uint128_t *self, uint32_t i )
{
__asm__ __volatile__
(
"mov 4(%%edx), %%eax;"
"shrd %%cl, %%eax, (%%edx);"
"mov 8(%%edx), %%eax;"
"shrd %%cl, %%eax, 4(%%edx);"
"mov 12(%%edx), %%eax;"
"shrd %%cl, %%eax, 8(%%edx);"
"shr %%cl, %%eax;"
"mov %%eax, 12(%%edx);"
:
: "d" ( self ), "c" ( i )
: "%eax"
);
}
static __inline__
void uint128_shl ( uint128_t *self, uint32_t i )
{
__asm__ __volatile__
(
"mov 8(%%edx), %%eax;"
"shld %%cl, %%eax, 12(%%edx);"
"mov 4(%%edx), %%eax;"
"shld %%cl, %%eax, 8(%%edx);"
"mov (%%edx), %%eax;"
"shld %%cl, %%eax, 4(%%edx);"
"shl %%cl, %%eax;"
"mov %%eax, (%%edx);"
:
: "d" ( self ), "c" ( i )
: "%eax"
);
}
static __inline__
void uint128_bswap ( uint128_t *self )
{
__asm__ __volatile__
(
"mov (%%ecx), %%eax;"
"mov 12(%%ecx), %%edx;"
"bswap %%eax;"
"bswap %%edx;"
"mov %%eax, 12(%%ecx);"
"mov %%edx, (%%ecx);"
"mov 4(%%ecx), %%eax;"
"mov 8(%%ecx), %%edx;"
"bswap %%eax;"
"bswap %%edx;"
"mov %%eax, 8(%%ecx);"
"mov %%edx, 4(%%ecx);"
:
: "c" ( self )
: "%eax", "%edx"
);
}
static __inline__
void uint128_bswap_copy ( uint128_t *to, const uint128_t *from )
{
__asm__ __volatile__
(
"push %%ebx;"
"mov (%%edx), %%eax;"
"mov 12(%%edx), %%ebx;"
"bswap %%eax;"
"bswap %%ebx;"
"mov %%eax, 12(%%ecx);"
"mov %%ebx, (%%ecx);"
"mov 4(%%edx), %%eax;"
"mov 8(%%edx), %%ebx;"
"bswap %%eax;"
"bswap %%ebx;"
"mov %%eax, 8(%%ecx);"
"mov %%ebx, 4(%%ecx);"
"pop %%ebx;"
:
: "c" ( to ), "d" ( from )
: "%eax"
);
}
#ifdef __cplusplus
}
#endif
#endif /* _h_arch_impl_ */
sra_sdk-2.1.7/interfaces/cc/gcc/i386/atomic.h 0000644 0012213 0011620 00000011562 11476747550 020242 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_atomic_
#define _h_atomic_
#ifndef _h_atomic32_
#include "atomic32.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct atomic32_t atomic_t;
/* ( * v ) */
#define atomic_read( v ) \
atomic32_read ( v )
/* ( * v ) = i */
#define atomic_set( v, i ) \
atomic32_set ( v, i )
/* prior = ( * v ), ( * v ) += i, prior */
#define atomic_read_and_add( v, i ) \
atomic32_read_and_add ( v, i )
/* ( * v ) += i */
#define atomic_add( v, i ) \
atomic32_add ( v, i )
/* ( * v ) += i */
#define atomic_add_and_read( v, i ) \
atomic32_add_and_read ( v, i )
/* ( void ) ++ ( * v ) */
#define atomic_inc( v ) \
atomic32_inc ( v )
/* ( void ) -- ( * v ) */
#define atomic_dec( v ) \
atomic32_dec ( v )
/* -- ( * v ) == 0 */
#define atomic_dec_and_test( v ) \
atomic32_dec_and_test ( v )
/* ++ ( * v ) == 0
when atomic_dec_and_test uses predecrement, you want
postincrement to this function. so it isn't very useful */
#define atomic_inc_and_test( v ) \
atomic32_inc_and_test ( v )
/* ( * v ) -- == 0
HERE's useful */
#define atomic_test_and_inc( v ) \
atomic32_test_and_inc ( v )
/* prior = ( * v ), ( * v ) = ( prior == t ? s : prior ), prior */
#define atomic_test_and_set( v, s, t ) \
atomic32_test_and_set ( v, s, t )
/* N.B. - THIS FUNCTION IS FOR 32 BIT PTRS ONLY */
static __inline__ void *atomic_test_and_set_ptr ( void *volatile *v, void *s, void *t )
{
void *rtn;
__asm__ __volatile__
(
"lock;"
"cmpxchg %%edx,(%%ecx)"
: "=a" ( rtn ), "=c" ( v )
: "c" ( v ), "d" ( s ), "a" ( t )
);
return rtn;
}
/* val = ( * v ), ( ( * v ) = ( val < t ) ? val + i : val ), val */
#define atomic_read_and_add_lt( v, i, t ) \
atomic32_read_and_add_lt ( v, i, t )
/* val = ( * v ), ( ( * v ) = ( val <= t ) ? val + i : val ), val */
#define atomic_read_and_add_le( v, i, t ) \
atomic32_read_and_add_le ( v, i, t )
/* val = ( * v ), ( ( * v ) = ( val == t ) ? val + i : val ), val */
#define atomic_read_and_add_eq( v, i, t ) \
atomic32_read_and_add_eq ( v, i, t )
/* val = ( * v ), ( ( * v ) = ( val != t ) ? val + i : val ), val */
#define atomic_read_and_add_ne( v, i, t ) \
atomic32_read_and_add_ne ( v, i, t )
/* val = ( * v ), ( ( * v ) = ( val >= t ) ? val + i : val ), val */
#define atomic_read_and_add_ge( v, i, t ) \
atomic32_read_and_add_ge ( v, i, t )
/* val = ( * v ), ( ( * v ) = ( val > t ) ? val + i : val ), val */
#define atomic_read_and_add_gt( v, i, t ) \
atomic32_read_and_add_gt ( v, i, t )
/* val = ( * v ), ( ( * v ) = ( ( val & 1 ) == 1 ) ? val + i : val ), val */
#define atomic_read_and_add_odd( v, i ) \
atomic32_read_and_add_odd ( v, i )
/* val = ( * v ), ( ( * v ) = ( ( val & 1 ) == 0 ) ? val + i : val ), val */
#define atomic_read_and_add_even( v, i ) \
atomic32_read_and_add_even ( v, i )
/* DEPRECATED */
/* val = ( * v ), ( * v ) = ( val < t ? val + i : val ), ( val < t ? 1 : 0 ) */
#define atomic_add_if_lt( v, i, t ) \
atomic32_add_if_lt ( v, i, t )
/* val = ( * v ), ( * v ) = ( val <= t ? val + i : val ), ( val <= t ? 1 : 0 ) */
#define atomic_add_if_le( v, i, t ) \
atomic32_add_if_le ( v, i, t )
/* val = ( * v ), ( * v ) = ( val == t ? val + i : val ), ( val == t ? 1 : 0 ) */
#define atomic_add_if_eq( v, i, t ) \
atomic32_add_if_eq ( v, i, t )
/* val = ( * v ), ( * v ) = ( val >= t ? val + i : val ), ( val >= t ? 1 : 0 ) */
#define atomic_add_if_ge( v, i, t ) \
atomic32_add_if_ge ( v, i, t )
/* val = ( * v ), ( * v ) = ( val > t ? val + i : val ), ( val > t ? 1 : 0 ) */
#define atomic_add_if_gt( v, i, t ) \
atomic32_add_if_gt ( v, i, t )
#undef LOCK
#ifdef __cplusplus
}
#endif
#endif /* _h_atomic_ */
sra_sdk-2.1.7/interfaces/cc/gcc/i386/atomic32.h 0000644 0012213 0011620 00000021145 11476747550 020405 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_atomic32_
#define _h_atomic32_
#ifdef __cplusplus
extern "C" {
#endif
/*
* Make sure gcc doesn't try to be clever and move things around
* on us. We need to use _exactly_ the address the user gave us,
* not some alias that contains the same information.
*/
typedef struct atomic32_t atomic32_t;
struct atomic32_t
{
volatile int counter;
};
/* int atomic32_read ( const atomic32_t *v ); */
#define atomic32_read( v ) \
( ( v ) -> counter )
/* void atomic32_set ( atomic32_t *v, int i ); */
#define atomic32_set( v, i ) \
( ( void ) ( ( ( v ) -> counter ) = ( i ) ) )
/* add to v -> counter and return the prior value */
static __inline__ int atomic32_read_and_add ( atomic32_t *v, int i )
{
int rtn;
__asm__ __volatile__
(
"push %%ebx;"
"mov (%%ecx), %%eax;"
"mov %%edx, %%ebx;"
"add %%eax, %%ebx;"
"lock;"
"cmpxchg %%ebx, (%%ecx);"
"jne .-8;"
"pop %%ebx"
: "=a" ( rtn ), "=c" ( v )
: "c" ( v ), "d" ( i )
);
return rtn;
}
/* if no read is needed, define the least expensive atomic add */
#define atomic32_add( v, i ) \
atomic32_read_and_add ( v, i )
/* add to v -> counter and return the result */
static __inline__ int atomic32_add_and_read ( atomic32_t *v, int i )
{
int rtn;
__asm__ __volatile__
(
"push %%ebx;"
"mov (%%ecx), %%eax;"
"mov %%edx, %%ebx;"
"add %%eax, %%ebx;"
"lock;"
"cmpxchg %%ebx, (%%ecx);"
"jne .-8;"
"mov %%ebx, %%eax;"
"pop %%ebx"
: "=a" ( rtn ), "=c" ( v )
: "c" ( v ), "d" ( i )
);
return rtn;
}
/* just don't try to find out what the result was */
static __inline__ void atomic32_inc ( atomic32_t *v )
{
__asm__ __volatile__
(
"lock;"
"incl %0"
:"=m" (v->counter)
:"m" (v->counter)
);
}
static __inline__ void atomic32_dec ( atomic32_t *v )
{
__asm__ __volatile__
(
"lock;"
"decl %0"
:"=m" (v->counter)
:"m" (v->counter)
);
}
/* decrement by one and test result for 0 */
static __inline__ int atomic32_dec_and_test ( atomic32_t *v )
{
unsigned char c;
__asm__ __volatile__
(
"lock;"
"decl %0;"
"sete %1"
:"=m" (v->counter), "=qm" (c)
:"m" (v->counter) : "memory"
);
return c;
}
/* when atomic32_dec_and_test uses predecrement, you want
postincrement to this function. so it isn't very useful */
static __inline__ int atomic32_inc_and_test ( atomic32_t *v )
{
unsigned char c;
__asm__ __volatile__
(
"lock;"
"incl %0;"
"sete %1"
:"=m" (v->counter), "=qm" (c)
:"m" (v->counter) : "memory"
);
return c;
}
/* HERE's useful */
#define atomic32_test_and_inc( v ) \
( atomic32_read_and_add ( v, 1 ) == 0 )
static __inline__ int atomic32_test_and_set ( atomic32_t *v, int s, int t )
{
int rtn;
__asm__ __volatile__
(
"lock;"
"cmpxchg %%edx,(%%ecx)"
: "=a" ( rtn ), "=c" ( v )
: "c" ( v ), "d" ( s ), "a" ( t )
);
return rtn;
}
/* conditional modifications */
static __inline__
int atomic32_read_and_add_lt ( atomic32_t *v, int i, int t )
{
int rtn;
__asm__ __volatile__
(
"push %%ebx;"
"mov (%%ecx), %%eax;"
"cmp %%esi, %%eax;"
"mov %%edx, %%ebx;"
"jge .+10;"
"add %%eax, %%ebx;"
"lock;"
"cmpxchg %%ebx, (%%ecx);"
"jne .-12;"
"pop %%ebx"
: "=a" ( rtn ), "=c" ( v )
: "c" ( v ), "d" ( i ), "S" ( t )
);
return rtn;
}
#define atomic32_add_if_lt( v, i, t ) \
( atomic32_read_and_add_lt ( v, i, t ) < ( t ) )
static __inline__
int atomic32_read_and_add_le ( atomic32_t *v, int i, int t )
{
int rtn;
__asm__ __volatile__
(
"push %%ebx;"
"mov (%%ecx), %%eax;"
"cmp %%esi, %%eax;"
"mov %%edx, %%ebx;"
"jg .+10;"
"add %%eax, %%ebx;"
"lock;"
"cmpxchg %%ebx, (%%ecx);"
"jne .-12;"
"pop %%ebx"
: "=a" ( rtn ), "=c" ( v )
: "c" ( v ), "d" ( i ), "S" ( t )
);
return rtn;
}
#define atomic32_add_if_le( v, i, t ) \
( atomic32_read_and_add_le ( v, i, t ) <= ( t ) )
static __inline__
int atomic32_read_and_add_eq ( atomic32_t *v, int i, int t )
{
int rtn;
__asm__ __volatile__
(
"push %%ebx;"
"mov (%%ecx), %%eax;"
"cmp %%esi, %%eax;"
"mov %%edx, %%ebx;"
"jne .+10;"
"add %%eax, %%ebx;"
"lock;"
"cmpxchg %%ebx, (%%ecx);"
"jne .-12;"
"pop %%ebx"
: "=a" ( rtn ), "=c" ( v )
: "c" ( v ), "d" ( i ), "S" ( t )
);
return rtn;
}
#define atomic32_add_if_eq( v, i, t ) \
( atomic32_read_and_add_eq ( v, i, t ) == ( t ) )
static __inline__
int atomic32_read_and_add_ne ( atomic32_t *v, int i, int t )
{
int rtn;
__asm__ __volatile__
(
"push %%ebx;"
"mov (%%ecx), %%eax;"
"cmp %%esi, %%eax;"
"mov %%edx, %%ebx;"
"je .+10;"
"add %%eax, %%ebx;"
"lock;"
"cmpxchg %%ebx, (%%ecx);"
"jne .-12;"
"pop %%ebx"
: "=a" ( rtn ), "=c" ( v )
: "c" ( v ), "d" ( i ), "S" ( t )
);
return rtn;
}
#define atomic32_add_if_ne( v, i, t ) \
( atomic32_read_and_add_ne ( v, i, t ) != ( t ) )
static __inline__
int atomic32_read_and_add_ge ( atomic32_t *v, int i, int t )
{
int rtn;
__asm__ __volatile__
(
"push %%ebx;"
"mov (%%ecx), %%eax;"
"cmp %%esi, %%eax;"
"mov %%edx, %%ebx;"
"jl .+10;"
"add %%eax, %%ebx;"
"lock;"
"cmpxchg %%ebx, (%%ecx);"
"jne .-12;"
"pop %%ebx"
: "=a" ( rtn ), "=c" ( v )
: "c" ( v ), "d" ( i ), "S" ( t )
);
return rtn;
}
#define atomic32_add_if_ge( v, i, t ) \
( atomic32_read_and_add_ge ( v, i, t ) >= ( t ) )
static __inline__
int atomic32_read_and_add_gt ( atomic32_t *v, int i, int t )
{
int rtn;
__asm__ __volatile__
(
"push %%ebx;"
"mov (%%ecx), %%eax;"
"cmp %%esi, %%eax;"
"mov %%edx, %%ebx;"
"jle .+10;"
"add %%eax, %%ebx;"
"lock;"
"cmpxchg %%ebx, (%%ecx);"
"jne .-12;"
"pop %%ebx"
: "=a" ( rtn ), "=c" ( v )
: "c" ( v ), "d" ( i ), "S" ( t )
);
return rtn;
}
#define atomic32_add_if_gt( v, i, t ) \
( atomic32_read_and_add_gt ( v, i, t ) > ( t ) )
static __inline__
int atomic32_read_and_add_odd ( atomic32_t *v, int i )
{
int rtn;
__asm__ __volatile__
(
"push %%ebx;"
"mov (%%ecx), %%eax;"
"bt $0, %%ax;"
"mov %%edx, %%ebx;"
"jnc .+10;"
"add %%eax, %%ebx;"
"lock;"
"cmpxchg %%ebx, (%%ecx);"
"jne .-15;"
"pop %%ebx"
: "=a" ( rtn ), "=c" ( v )
: "c" ( v ), "d" ( i )
);
return rtn;
}
static __inline__
int atomic32_read_and_add_even ( atomic32_t *v, int i )
{
int rtn;
__asm__ __volatile__
(
"push %%ebx;"
"mov (%%ecx), %%eax;"
"bt $0, %%ax;"
"mov %%edx, %%ebx;"
"jc .+10;"
"add %%eax, %%ebx;"
"lock;"
"cmpxchg %%ebx, (%%ecx);"
"jne .-15;"
"pop %%ebx"
: "=a" ( rtn ), "=c" ( v )
: "c" ( v ), "d" ( i )
);
return rtn;
}
#ifdef __cplusplus
}
#endif
#endif /* _h_atomic32_ */
sra_sdk-2.1.7/interfaces/cc/gcc/i386/bitstr.h 0000644 0012213 0011620 00000002727 11476747550 020300 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_bitstr_
#define _h_bitstr_
/* use 32-bit accumulator, 16-bit word size */
#define WRDSIZE 16
#define WRDSHIFT 4
#define WRD uint16_t
#define ACC uint32_t
#define BSWAP( x ) bswap_16 ( x )
#include "../noarch/bitstr.h"
#endif /* _h_bitstr_ */
sra_sdk-2.1.7/interfaces/cc/gcc/i386/fmtdef.h 0000644 0012213 0011620 00000003043 11476747550 020226 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_fmtdef_
#define _h_fmtdef_
/* int64_t is "long long int" in 32 bit */
#define LD64 "lld"
#define LU64 "llu"
#define LX64 "llX"
#define Lx64 "llx"
/* size_t is traditionally "unsigned int"
although it should have been "long unsigned int" */
#define LUSZ "u"
#define LXSZ "X"
#define LxSZ "x"
#endif /* _h_fmtdef_ */
sra_sdk-2.1.7/interfaces/cc/gcc/i386/strtol.h 0000644 0012213 0011620 00000003671 11476747550 020317 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_strtol_
#define _h_strtol_
#ifndef _h_os_native_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* strtoi32
* strtoi32
* based upon actual usage
*/
#define strtoi32( str, endp, base ) \
strtol ( str, endp, base )
#define strtou32( str, endp, base ) \
strtoul ( str, endp, base )
/*--------------------------------------------------------------------------
* strtoi64
* strtoi64
* based upon actual usage
*/
#define strtoi64( str, endp, base ) \
strtoll ( str, endp, base )
#define strtou64( str, endp, base ) \
strtoull ( str, endp, base )
#ifdef __cplusplus
}
#endif
#endif /* _h_strtol_ */
sra_sdk-2.1.7/interfaces/cc/gcc/i386/byteswap.h 0000644 0012213 0011620 00000004410 11556621244 020604 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_byteswap_
#define _h_byteswap_
#ifdef _BYTESWAP_H
#warning "GNU byteswap.h being used"
#else
#define _BYTESWAP_H 1234
#include
#ifdef __cplusplus
extern "C" {
#endif
/* perform single instruction byte swap */
static __inline__ uint16_t bswap_16 ( uint16_t i )
{
register uint16_t rtn;
__asm__
(
"rorw $8, %w0"
: "=r" ( rtn )
: "0" ( i )
: "cc"
);
return rtn;
}
/* perform single instruction byte swap */
static __inline__ uint32_t bswap_32 ( uint32_t i )
{
register uint32_t rtn;
__asm__
(
"bswap %0"
: "=r" ( rtn )
: "0" ( i )
: "cc"
);
return rtn;
}
/* perform multi-instruction byte swap */
static __inline__ uint64_t bswap_64 ( uint64_t i )
{
union
{
uint64_t ll;
uint32_t l [ 2 ];
} in, rtn;
in . ll = i;
rtn . l [ 0 ] = bswap_32 ( in . l [ 1 ] );
rtn . l [ 1 ] = bswap_32 ( in . l [ 0 ] );
return rtn . ll;
}
#ifdef __cplusplus
}
#endif
#endif /* _BYTESWAP_H */
#endif /* _h_byteswap_ */
sra_sdk-2.1.7/interfaces/cc/gcc/noarch/ 0000755 0012213 0011620 00000000000 11477730356 017366 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/cc/gcc/noarch/bitstr.h 0000644 0012213 0011620 00000040671 11476747550 021061 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_noarch_bitstr_
#define _h_noarch_bitstr_
#ifndef _h_bitstr_
#error "don't include directly - use "
#endif
#ifndef _h_klib_defs_
#include
#endif
#include
#ifdef __cplusplus
extern "C" {
#endif
/* bitcpy
* copy a string of bits from source to dest
*
* both source and dest may have non-byte aligned pointers
* the number of bits to copy need not be byte aligned
*
* depending upon architecture and OS conventions, the word
* size may be adjusted to 1, 2, or 4 bytes, where the base
* pointers are always word aligned.
*
* bits in memory are always treated as big-endian, meaning
* that on multi-byte fetches and stores, we perform byte-swapping
* if there are shifts or masks
*/
static __inline__
void bitcpy ( void *dbase, bitsz_t doff, const void *sbase, bitsz_t soff, bitsz_t sz )
{
/* noop if sz == 0 */
if ( sz != 0 )
{
/* loop counter and destination word count */
size_t i, dcountz;
/* left & right masks and working register */
WRD lmask, rmask, reg;
/* produce word-aligned pointers */
#if WRDSIZE == 8
/* 1-4. all at once */
WRD *dst = ( WRD* ) dbase + ( doff >> WRDSHIFT );
const WRD *src = ( const WRD* ) sbase + ( soff >> WRDSHIFT );
#else
/* 1. capture word alignment adjustment */
size_t dadjust = ( size_t ) dbase & ( WRDSIZE / 8 - 1 );
size_t sadjust = ( size_t ) sbase & ( WRDSIZE / 8 - 1 );
/* 2. create word-aligned pointers */
WRD *dst = ( WRD* ) ( ( size_t ) dbase - dadjust );
const WRD *src = ( const WRD* ) ( ( size_t ) sbase - sadjust );
/* 3. incorporate alignment adjustment into offset bits */
doff += dadjust << 3;
soff += sadjust << 3;
/* 4. readjust pointers based upon offset */
dst += doff >> WRDSHIFT;
src += soff >> WRDSHIFT;
#endif
/* 5. restate offsets */
doff &= ( WRDSIZE - 1 );
soff &= ( WRDSIZE - 1 );
/* calculate number of words - 1 in dst */
dcountz = ( doff + sz + ( WRDSIZE - 1 ) - WRDSIZE ) >> WRDSHIFT;
/* calculate masks */
lmask = rmask = ~ 0;
lmask >>= doff;
rmask >>= ( doff + sz ) & ( WRDSIZE - 1 );
if ( ( WRD ) ( rmask + 1 ) == 0 )
rmask = 0;
/* prime register with masked dst [ 0 ] */
reg = BSWAP ( dst [ 0 ] ) & ~ lmask;
/* if source and destination are aligned */
if ( doff == soff )
{
/* merge src [ 0 ] into reg through mask */
reg |= BSWAP ( src [ 0 ] ) & lmask;
#if WRDSIZE > 8
/* straight copies don't need byteswap
other than on first and last words
put first word back into little-endian
for remainder of loop */
if ( dcountz > 0 )
{
reg = BSWAP ( reg );
#endif
/* aligned buffers have n:n word ratio */
for ( i = 0; i < dcountz; )
{
dst [ i ] = reg;
reg = src [ ++ i ];
}
#if WRDSIZE > 8
/* revert to big-endian */
reg = BSWAP ( reg );
}
#endif
}
/* shifting alignment */
else
{
/* source count may differ from dest count */
size_t scountz = ( soff + sz + ( WRDSIZE - 1 ) - WRDSIZE ) >> WRDSHIFT;
/* use double-word accumulator */
ACC acc = BSWAP ( src [ 0 ] );
/* shift amount */
int shift = ( int ) doff - ( int ) soff;
if ( shift > 0 )
{
/* take only valid bits in shifted initial src */
reg |= ( WRD ) ( acc >> shift ) & lmask;
/* because "shift" > 0, we know "dcountz" >= "scountz" */
for ( acc <<= WRDSIZE, i = 0; i < scountz; acc <<= WRDSIZE )
{
dst [ i ] = BSWAP ( reg );
acc |= BSWAP ( src [ ++ i ] );
reg = ( WRD ) ( acc >> shift );
}
/* if "dcountz" > "scountz" */
if ( i < dcountz )
{
dst [ i ] = BSWAP ( reg );
reg = ( WRD ) ( acc >> shift );
}
}
else
{
/* need single word read-ahead and right-shift */
shift += WRDSIZE;
/* because "shift" was < 0, we know "dcountz" <= "scountz" */
for ( acc <<= WRDSIZE, i = 0; i < dcountz; acc <<= WRDSIZE )
{
acc |= BSWAP ( src [ i + 1 ] );
reg |= ( WRD ) ( acc >> shift ) & lmask;
dst [ i ++ ] = BSWAP ( reg );
lmask = ~ 0;
reg = 0;
}
/* if "dcountz" < "scountz" */
if ( i < scountz )
acc |= BSWAP ( src [ scountz ] );
reg |= ( WRD ) ( acc >> shift ) & lmask;
}
}
/* mask off unused bytes from src */
reg &= ~ rmask;
/* bring in saved bits from dst */
reg |= BSWAP ( dst [ dcountz ] ) & rmask;
/* write out last word */
dst [ dcountz ] = BSWAP ( reg );
}
}
/* bitcmp
* performs bitwise a - b, returning result as int
* result value has no meaning, only sign
* where < 0 means a < b, > 0 means a > b, and 0 means a == b
*
* since the comparison produces a tri-state indicator of
* relative magnitude, the order of "a" and "b" is important.
* furthermore, the difference operator must be evaluated
* left to right, because the result indicates more than
* equality.
*
* see bitcpy for general word alignment information
*/
static __inline__
int bitcmp ( const void *abase, bitsz_t aoff, const void *bbase, bitsz_t boff, bitsz_t sz )
{
int diff = 0;
if ( sz != 0 )
{
/* loop counter and left word count */
size_t i, lcountz;
/* left & right masks and working registers */
WRD lmask, rmask, lreg, rreg;
/* produce word-aligned pointers */
#if WRDSIZE == 8
/* 1-4. all at once */
const WRD *left = ( const WRD* ) abase + ( aoff >> WRDSHIFT );
const WRD *right = ( const WRD* ) bbase + ( boff >> WRDSHIFT );
#else
/* 1. capture word alignment adjustment */
size_t aadjust = ( size_t ) abase & ( WRDSIZE / 8 - 1 );
size_t badjust = ( size_t ) bbase & ( WRDSIZE / 8 - 1 );
/* 2. create word-aligned pointers */
const WRD *left = ( const WRD* ) ( ( size_t ) abase - aadjust );
const WRD *right = ( const WRD* ) ( ( size_t ) bbase - badjust );
/* 3. incorporate alignment adjustment into offset bits */
aoff += aadjust << 3;
boff += badjust << 3;
/* 4. readjust pointers based upon offset */
left += aoff >> WRDSHIFT;
right += boff >> WRDSHIFT;
#endif
/* 5. restate offsets */
aoff &= ( WRDSIZE - 1 );
boff &= ( WRDSIZE - 1 );
/* calculate number of words - 1 in left
since we know a-priori that "sz" > 0, we
know that the left and right counts must be
at least 1. our loops treat the last word
specially, so calculate a loop counter that
excludes the last word */
lcountz = ( aoff + sz + ( WRDSIZE - 1 ) - WRDSIZE ) >> WRDSHIFT;
/* calculate masks */
lmask = rmask = ~ 0;
lmask >>= aoff;
rmask >>= ( aoff + sz ) & ( WRDSIZE - 1 );
if ( ( WRD ) ( rmask + 1 ) == 0 )
rmask = 0;
/* significant bits from left [ 0 ] */
lreg = BSWAP ( left [ 0 ] ) & lmask;
/* if source and destination are aligned */
if ( aoff == boff )
{
/* test against right bits through mask */
rreg = BSWAP ( right [ 0 ] ) & lmask;
/* produce a difference of all but the last
aligned word, where initial word has been
left-masked. the last word is tested below. */
for ( i = 1; i <= lcountz; ++ i )
{
diff = ( int ) lreg - ( int ) rreg;
if ( diff != 0 )
return diff;
/* byte-swapping occurs on little-endian architectures */
lreg = BSWAP ( left [ i ] );
rreg = BSWAP ( right [ i ] );
}
/* fall out to end for masked comparison of last word */
}
/* shifting alignment */
else
{
/* right count may differ from left count
since alignments differ, the span of "sz"
bits may hit a different number of words in
the left array than in the right. */
size_t rcountz = ( boff + sz + ( WRDSIZE - 1 ) - WRDSIZE ) >> WRDSHIFT;
/* use double-word accumulator
note that the extra bits get ignored */
ACC acc = BSWAP ( right [ 0 ] );
/* shift amount: positive if "b" needs to be right shifted.
NOTE - since the comparison must be successively performed
from left to right ( see above ), shifting is ALWAYS toward
right, making for special handling when "shift" < 0 ( see below ) */
int shift = ( int ) aoff - ( int ) boff;
if ( shift > 0 )
{
/* initial word from right operand, aligned with left */
rreg = ( WRD ) ( acc >> shift ) & lmask;
/* "shift" > 0 means "lcountz" >= "rcountz" */
for ( acc <<= WRDSIZE, i = 1; i <= rcountz; acc <<= WRDSIZE, ++ i )
{
/* compare words at i-1 */
diff = ( int ) lreg - ( int ) rreg;
if ( diff != 0 )
return diff;
/* accumulate next word from right operand */
acc |= BSWAP ( right [ i ] );
/* bring in next word from left operand */
lreg = BSWAP ( left [ i ] );
/* produce aligned word from right operand */
rreg = ( WRD ) ( acc >> shift );
}
/* if there is one more word in left */
if ( lcountz > rcountz )
{
/* compare penultimate */
diff = ( int ) lreg - ( int ) rreg;
if ( diff != 0 )
return diff;
/* get last word in left */
lreg = BSWAP ( left [ lcountz ] );
/* last word from right is already in "acc" */
rreg = ( WRD ) ( acc >> shift );
}
/* fall out to end for masked comparison of last word */
}
else
{
/* since all shifts must be toward right ( due to left to right
comparison ), this alignment will require a pre-fetch from
right operand into accumulator, and adjusting the negative
shift amount to a positive right-shift. */
shift += WRDSIZE;
/* since "shift" was negative, we know "lcountz" <= "rcountz",
so use "lcountz" as loop limit. pre-shift "acc" as loop init */
for ( acc <<= WRDSIZE, i = 1; i <= lcountz; acc <<= WRDSIZE, ++ i )
{
/* accumulate next word from right operand */
acc |= BSWAP ( right [ i ] );
/* produce aligned word from right operand */
rreg = ( WRD ) ( acc >> shift ) & lmask;
/* now test against left */
diff = ( int ) lreg - ( int ) rreg;
if ( diff != 0 )
return diff;
/* bring in next word from left operand */
lreg = BSWAP ( left [ i ] );
/* no more left mask */
lmask = ~ 0;
}
/* if there is one more word in right */
if ( lcountz < rcountz )
acc |= BSWAP ( right [ rcountz ] );
/* produce "rreg" from "acc" */
rreg = ( WRD ) ( acc >> shift ) & lmask;
/* fall out to end for masked comparison of last word */
}
}
/* mask off unused bytes from right */
lreg &= ~ rmask;
rreg &= ~ rmask;
/* perform final comparison */
diff = ( int ) lreg - ( int ) rreg;
}
return diff;
}
#ifdef __cplusplus
}
#endif
#endif /* _h_noarch_bitstr_ */
sra_sdk-2.1.7/interfaces/cc/gcc/x86_64/ 0000755 0012213 0011620 00000000000 11477730356 017052 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/cc/gcc/x86_64/arch-impl.h 0000644 0012213 0011620 00000015255 11476747550 021112 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_arch_impl_
#define _h_arch_impl_
#include
#ifdef __cplusplus
extern "C" {
#endif
static __inline__
int16_t uint16_lsbit ( uint16_t self )
{
int16_t rtn;
__asm__ __volatile__
(
"bsf %%ax, %%ax;"
"jnz .+6;"
"xor %%eax, %%eax;"
"dec %%eax;"
: "=a" ( rtn )
: "a" ( self )
);
return rtn;
}
static __inline__
int32_t uint32_lsbit ( uint32_t self )
{
int32_t rtn;
__asm__ __volatile__
(
"bsf %%eax, %%eax;"
"jnz .+6;"
"xor %%eax, %%eax;"
"dec %%eax;"
: "=a" ( rtn )
: "a" ( self )
);
return rtn;
}
typedef struct int128_t int128_t;
struct int128_t
{
uint64_t lo;
int64_t hi;
};
static __inline__
int64_t int128_hi ( const int128_t *self )
{
return self -> hi;
}
static __inline__
uint64_t int128_lo ( const int128_t *self )
{
return self -> lo;
}
static __inline__
void int128_sethi ( int128_t *self, int64_t i )
{
self -> hi = i;
}
static __inline__
void int128_setlo ( int128_t *self, uint64_t i )
{
self -> lo = i;
}
typedef struct uint128_t uint128_t;
struct uint128_t
{
uint64_t lo;
uint64_t hi;
};
static __inline__
uint64_t uint128_hi ( const uint128_t *self )
{
return self -> hi;
}
static __inline__
uint64_t uint128_lo ( const uint128_t *self )
{
return self -> lo;
}
static __inline__
void uint128_sethi ( uint128_t *self, uint64_t i )
{
self -> hi = i;
}
static __inline__
void uint128_setlo ( uint128_t *self, uint64_t i )
{
self -> lo = i;
}
static __inline__
void int128_add ( int128_t *self, const int128_t *i )
{
__asm__ __volatile__
(
"mov (%%rsi), %%rax;"
"mov 8(%%rsi), %%rcx;"
"add %%rax, (%%rdi);"
"adc %%rcx, 8(%%rdi);"
:
: "D" ( self ), "S" ( i )
: "%rax", "%rcx"
);
}
static __inline__
void int128_sub ( int128_t *self, const int128_t *i )
{
__asm__ __volatile__
(
"mov (%%rsi), %%rax;"
"mov 8(%%rsi), %%rcx;"
"sub %%rax, (%%rdi);"
"sbb %%rcx, 8(%%rdi);"
:
: "D" ( self ), "S" ( i )
: "%rax", "%rcx"
);
}
static __inline__
void int128_sar ( int128_t *self, uint32_t i )
{
__asm__ __volatile__
(
"mov %%esi, %%ecx;"
"mov 8(%%rdi), %%rax;"
"shrd %%cl, %%rax, (%%rdi);"
"sar %%cl, %%rax;"
"mov %%rax, 8(%%rdi);"
:
: "D" ( self ), "S" ( i )
: "%rax", "%rcx"
);
}
static __inline__
void int128_shl ( int128_t *self, uint32_t i )
{
__asm__ __volatile__
(
"mov %%esi, %%ecx;"
"mov (%%rdi), %%rax;"
"shld %%cl, %%rax, 8(%%rdi);"
"shl %%cl, %%rax;"
"mov %%rax, (%%rdi);"
:
: "D" ( self ), "S" ( i )
: "%rax", "%rcx"
);
}
static __inline__
void uint128_and ( uint128_t *self, const uint128_t *i )
{
__asm__ __volatile__
(
"mov (%%rsi), %%rax;"
"mov 8(%%rsi), %%rcx;"
"and %%rax, (%%rdi);"
"and %%rcx, 8(%%rdi);"
:
: "D" ( self ), "S" ( i )
:"%rax", "%rcx"
);
}
static __inline__
void uint128_or ( uint128_t *self, const uint128_t *i )
{
__asm__ __volatile__
(
"mov (%%rsi), %%rax;"
"mov 8(%%rsi), %%rcx;"
"or %%rax, (%%rdi);"
"or %%rcx, 8(%%rdi);"
:
: "D" ( self ), "S" ( i )
:"%rax", "%rcx"
);
}
static __inline__
void uint128_orlo ( uint128_t *self, uint64_t i )
{
self -> lo |= i;
}
static __inline__
void uint128_xor ( uint128_t *self, const uint128_t *i )
{
__asm__ __volatile__
(
"mov (%%rsi), %%rax;"
"mov 8(%%rsi), %%rcx;"
"xor %%rax, (%%rdi);"
"xor %%rcx, 8(%%rdi);"
:
: "D" ( self ), "S" ( i )
:"%rax", "%rcx"
);
}
static __inline__
void uint128_not ( uint128_t *self )
{
__asm__ __volatile__
(
"mov (%%rdi), %%rax;"
"mov 8(%%rdi), %%rcx;"
"not %%rax;"
"not %%rcx;"
"mov %%rax, (%%rdi);"
"mov %%rcx, 8(%%rdi);"
:
: "D" ( self )
: "%rax", "%rcx"
);
}
static __inline__
void uint128_shr ( uint128_t *self, uint32_t i )
{
__asm__ __volatile__
(
"mov %%esi, %%ecx;"
"mov 8(%%rdi), %%rax;"
"shrd %%cl, %%rax, (%%rdi);"
"shr %%cl, %%rax;"
"mov %%rax, 8(%%rdi);"
:
: "D" ( self ), "S" ( i )
: "%rax", "%rcx"
);
}
static __inline__
void uint128_shl ( uint128_t *self, uint32_t i )
{
__asm__ __volatile__
(
"mov %%esi, %%ecx;"
"mov (%%rdi), %%rax;"
"shld %%cl, %%rax, 8(%%rdi);"
"shl %%cl, %%rax;"
"mov %%rax, (%%rdi);"
:
: "D" ( self ), "S" ( i )
: "%rax", "%rcx"
);
}
static __inline__
void uint128_bswap ( uint128_t *self )
{
__asm__ __volatile__
(
"mov (%%rdi), %%rax;"
"mov 8(%%rdi), %%rcx;"
"bswap %%rax;"
"bswap %%rcx;"
"mov %%rax, 8(%%rdi);"
"mov %%rcx, (%%rdi);"
:
: "D" ( self )
: "%rax", "%rcx"
);
}
static __inline__
void uint128_bswap_copy ( uint128_t *to, const uint128_t *from )
{
__asm__ __volatile__
(
"mov (%%rsi), %%rax;"
"mov 8(%%rsi), %%rcx;"
"bswap %%rax;"
"bswap %%rcx;"
"mov %%rax, 8(%%rdi);"
"mov %%rcx, (%%rdi);"
:
: "D" ( to ), "S" ( from )
: "%rax", "%rcx"
);
}
#ifdef __cplusplus
}
#endif
#endif /* _h_arch_impl_ */
sra_sdk-2.1.7/interfaces/cc/gcc/x86_64/atomic.h 0000644 0012213 0011620 00000012427 11542737113 020474 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_atomic_
#define _h_atomic_
#ifndef _h_atomic32_
#include "atomic32.h"
#endif
#ifndef _h_atomic64_
#include "atomic64.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if DFLT_ATOMIC_BITS == 32
#define ATOMIC_NAME( suffix ) \
atomic32_ ## suffix
typedef int atomic_int;
#else
#define ATOMIC_NAME( suffix ) \
atomic64_ ## suffix
typedef long int atomic_int;
#endif
typedef struct ATOMIC_NAME ( t ) atomic_t;
/* ( * v ) */
#define atomic_read( v ) \
ATOMIC_NAME ( read ) ( v )
/* ( * v ) = i */
#define atomic_set( v, i ) \
ATOMIC_NAME ( set ) ( v, i )
/* prior = ( * v ), ( * v ) += i, prior */
#define atomic_read_and_add( v, i ) \
ATOMIC_NAME ( read_and_add ) ( v, i )
/* ( * v ) += i */
#define atomic_add( v, i ) \
ATOMIC_NAME ( add ) ( v, i )
/* ( * v ) += i */
#define atomic_add_and_read( v, i ) \
ATOMIC_NAME ( add_and_read ) ( v, i )
/* ( void ) ++ ( * v ) */
#define atomic_inc( v ) \
ATOMIC_NAME ( inc ) ( v )
/* ( void ) -- ( * v ) */
#define atomic_dec( v ) \
ATOMIC_NAME ( dec ) ( v )
/* -- ( * v ) == 0 */
#define atomic_dec_and_test( v ) \
ATOMIC_NAME ( dec_and_test ) ( v )
/* ++ ( * v ) == 0
when atomic_dec_and_test uses predecrement, you want
postincrement to this function. so it isn't very useful */
#define atomic_inc_and_test( v ) \
ATOMIC_NAME ( inc_and_test ) ( v )
/* ( * v ) -- == 0
HERE's useful */
#define atomic_test_and_inc( v ) \
ATOMIC_NAME ( test_and_inc ) ( v )
/* prior = ( * v ), ( * v ) = ( prior == t ? s : prior ), prior */
#define atomic_test_and_set( v, s, t ) \
ATOMIC_NAME ( test_and_set ) ( v, s, t )
/* N.B. - THIS FUNCTION IS FOR 64 BIT PTRS ONLY */
static __inline__ void *atomic_test_and_set_ptr ( void *volatile *v, void *s, void *t )
{
void *rtn;
__asm__ __volatile__
(
"lock;"
"cmpxchg %%rsi,(%%rdi)"
: "=a" ( rtn )
: "D" ( v ), "S" ( s ), "a" ( t )
);
return rtn;
}
/* val = ( * v ), ( ( * v ) = ( val < t ) ? val + i : val ), val */
#define atomic_read_and_add_lt( v, i, t ) \
ATOMIC_NAME ( read_and_add_lt ) ( v, i, t )
/* val = ( * v ), ( ( * v ) = ( val <= t ) ? val + i : val ), val */
#define atomic_read_and_add_le( v, i, t ) \
ATOMIC_NAME ( read_and_add_le ) ( v, i, t )
/* val = ( * v ), ( ( * v ) = ( val == t ) ? val + i : val ), val */
#define atomic_read_and_add_eq( v, i, t ) \
ATOMIC_NAME ( read_and_add_eq ) ( v, i, t )
/* val = ( * v ), ( ( * v ) = ( val != t ) ? val + i : val ), val */
#define atomic_read_and_add_ne( v, i, t ) \
ATOMIC_NAME ( read_and_add_ne ) ( v, i, t )
/* val = ( * v ), ( ( * v ) = ( val >= t ) ? val + i : val ), val */
#define atomic_read_and_add_ge( v, i, t ) \
ATOMIC_NAME ( read_and_add_ge ) ( v, i, t )
/* val = ( * v ), ( ( * v ) = ( val > t ) ? val + i : val ), val */
#define atomic_read_and_add_gt( v, i, t ) \
ATOMIC_NAME ( read_and_add_gt ) ( v, i, t )
/* val = ( * v ), ( ( * v ) = ( ( val & 1 ) == 1 ) ? val + i : val ), val */
#define atomic_read_and_add_odd( v, i ) \
ATOMIC_NAME ( read_and_add_odd ) ( v, i )
/* val = ( * v ), ( ( * v ) = ( ( val & 1 ) == 0 ) ? val + i : val ), val */
#define atomic_read_and_add_even( v, i ) \
ATOMIC_NAME ( read_and_add_even ) ( v, i )
/* DEPRECATED */
/* val = ( * v ), ( * v ) = ( val < t ? val + i : val ), ( val < t ? 1 : 0 ) */
#define atomic_add_if_lt( v, i, t ) \
ATOMIC_NAME ( add_if_lt ) ( v, i, t )
/* val = ( * v ), ( * v ) = ( val <= t ? val + i : val ), ( val <= t ? 1 : 0 ) */
#define atomic_add_if_le( v, i, t ) \
ATOMIC_NAME ( add_if_le ) ( v, i, t )
/* val = ( * v ), ( * v ) = ( val == t ? val + i : val ), ( val == t ? 1 : 0 ) */
#define atomic_add_if_eq( v, i, t ) \
ATOMIC_NAME ( add_if_eq ) ( v, i, t )
/* val = ( * v ), ( * v ) = ( val >= t ? val + i : val ), ( val >= t ? 1 : 0 ) */
#define atomic_add_if_ge( v, i, t ) \
ATOMIC_NAME ( add_if_ge ) ( v, i, t )
/* val = ( * v ), ( * v ) = ( val > t ? val + i : val ), ( val > t ? 1 : 0 ) */
#define atomic_add_if_gt( v, i, t ) \
ATOMIC_NAME ( add_if_gt ) ( v, i, t )
#undef LOCK
#ifdef __cplusplus
}
#endif
#endif /* _h_atomic_ */
sra_sdk-2.1.7/interfaces/cc/gcc/x86_64/atomic32.h 0000644 0012213 0011620 00000020363 11476747550 020653 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_atomic32_
#define _h_atomic32_
#ifdef __cplusplus
extern "C" {
#endif
/*
* Make sure gcc doesn't try to be clever and move things around
* on us. We need to use _exactly_ the address the user gave us,
* not some alias that contains the same information.
*/
typedef struct atomic32_t atomic32_t;
struct atomic32_t
{
volatile int counter;
};
/* int atomic32_read ( const atomic32_t *v ); */
#define atomic32_read( v ) \
( ( v ) -> counter )
/* void atomic32_set ( atomic32_t *v, int i ); */
#define atomic32_set( v, i ) \
( ( void ) ( ( ( v ) -> counter ) = ( i ) ) )
/* add to v -> counter and return the prior value */
static __inline__ int atomic32_read_and_add ( atomic32_t *v, int i )
{
int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%eax;"
"mov %%esi, %%ecx;"
"add %%eax, %%ecx;"
"lock;"
"cmpxchg %%ecx, (%%rdi);"
"jne .-8"
: "=a" ( rtn )
: "D" ( v ), "S" ( i )
: "%ecx"
);
return rtn;
}
/* if no read is needed, define the least expensive atomic add */
#define atomic32_add( v, i ) \
atomic32_read_and_add ( v, i )
/* add to v -> counter and return the result */
static __inline__ int atomic32_add_and_read ( atomic32_t *v, int i )
{
int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%eax;"
"mov %%esi, %%ecx;"
"add %%eax, %%ecx;"
"lock;"
"cmpxchg %%ecx,(%%rdi);"
"jne .-8;"
"mov %%ecx, %%eax"
: "=a" ( rtn )
: "D" ( v ), "S" ( i )
: "%ecx"
);
return rtn;
}
/* just don't try to find out what the result was */
static __inline__ void atomic32_inc ( atomic32_t *v )
{
__asm__ __volatile__
(
"lock;"
"incl %0"
: "=m" ( v -> counter )
: "m" ( v -> counter )
);
}
static __inline__ void atomic32_dec ( atomic32_t *v )
{
__asm__ __volatile__
(
"lock;"
"decl %0"
: "=m" ( v -> counter )
: "m" ( v -> counter )
);
}
/* decrement by one and test result for 0 */
static __inline__ int atomic32_dec_and_test ( atomic32_t *v )
{
unsigned char c;
__asm__ __volatile__
(
"lock;"
"decl %2;"
"sete %%al"
: "=a" ( c ), "=m" ( v -> counter )
: "m" ( v -> counter )
);
return c;
}
/* when atomic32_dec_and_test uses predecrement, you want
postincrement to this function. so it isn't very useful */
static __inline__ int atomic32_inc_and_test ( atomic32_t *v )
{
unsigned char c;
__asm__ __volatile__
(
"lock;"
"incl %2;"
"sete %%al"
: "=a" ( c ), "=m" ( v -> counter )
: "m" ( v -> counter )
);
return c;
}
/* HERE's useful */
#define atomic32_test_and_inc( v ) \
( atomic32_read_and_add ( v, 1 ) == 0 )
static __inline__ int atomic32_test_and_set ( atomic32_t *v, int s, int t )
{
int rtn;
__asm__ __volatile__
(
"lock;"
"cmpxchg %%esi,(%%rdi)"
: "=a" ( rtn )
: "D" ( v ), "S" ( s ), "a" ( t )
);
return rtn;
}
/* conditional modifications */
static __inline__
int atomic32_read_and_add_lt ( atomic32_t *v, int i, int t )
{
int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%eax;"
"cmp %%edx, %%eax;"
"mov %%esi, %%ecx;"
"jge .+10;"
"add %%eax, %%ecx;"
"lock;"
"cmpxchg %%ecx, (%%rdi);"
"jne .-12"
: "=a" ( rtn )
: "D" ( v ), "S" ( i ), "d" ( t )
: "%ecx"
);
return rtn;
}
#define atomic32_add_if_lt( v, i, t ) \
( atomic32_read_and_add_lt ( v, i, t ) < ( t ) )
static __inline__
int atomic32_read_and_add_le ( atomic32_t *v, int i, int t )
{
int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%eax;"
"cmp %%edx, %%eax;"
"mov %%esi, %%ecx;"
"jg .+10;"
"add %%eax, %%ecx;"
"lock;"
"cmpxchg %%ecx, (%%rdi);"
"jne .-12"
: "=a" ( rtn )
: "D" ( v ), "S" ( i ), "d" ( t )
: "%ecx"
);
return rtn;
}
#define atomic32_add_if_le( v, i, t ) \
( atomic32_read_and_add_le ( v, i, t ) <= ( t ) )
static __inline__
int atomic32_read_and_add_eq ( atomic32_t *v, int i, int t )
{
int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%eax;"
"cmp %%edx, %%eax;"
"mov %%esi, %%ecx;"
"jne .+10;"
"add %%eax, %%ecx;"
"lock;"
"cmpxchg %%ecx, (%%rdi);"
"jne .-12"
: "=a" ( rtn )
: "D" ( v ), "S" ( i ), "d" ( t )
: "%ecx"
);
return rtn;
}
#define atomic32_add_if_eq( v, i, t ) \
( atomic32_read_and_add_eq ( v, i, t ) == ( t ) )
static __inline__
int atomic32_read_and_add_ne ( atomic32_t *v, int i, int t )
{
int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%eax;"
"cmp %%edx, %%eax;"
"mov %%esi, %%ecx;"
"je .+10;"
"add %%eax, %%ecx;"
"lock;"
"cmpxchg %%ecx, (%%rdi);"
"jne .-12"
: "=a" ( rtn )
: "D" ( v ), "S" ( i ), "d" ( t )
: "%ecx"
);
return rtn;
}
#define atomic32_add_if_ne( v, i, t ) \
( atomic32_read_and_add_ne ( v, i, t ) != ( t ) )
static __inline__
int atomic32_read_and_add_ge ( atomic32_t *v, int i, int t )
{
int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%eax;"
"cmp %%edx, %%eax;"
"mov %%esi, %%ecx;"
"jl .+10;"
"add %%eax, %%ecx;"
"lock;"
"cmpxchg %%ecx, (%%rdi);"
"jne .-12"
: "=a" ( rtn )
: "D" ( v ), "S" ( i ), "d" ( t )
: "%ecx"
);
return rtn;
}
#define atomic32_add_if_ge( v, i, t ) \
( atomic32_read_and_add_ge ( v, i, t ) >= ( t ) )
static __inline__
int atomic32_read_and_add_gt ( atomic32_t *v, int i, int t )
{
int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%eax;"
"cmp %%edx, %%eax;"
"mov %%esi, %%ecx;"
"jle .+10;"
"add %%eax, %%ecx;"
"lock;"
"cmpxchg %%ecx, (%%rdi);"
"jne .-12"
: "=a" ( rtn )
: "D" ( v ), "S" ( i ), "d" ( t )
: "%ecx"
);
return rtn;
}
#define atomic32_add_if_gt( v, i, t ) \
( atomic32_read_and_add_gt ( v, i, t ) > ( t ) )
static __inline__
int atomic32_read_and_add_odd ( atomic32_t *v, int i )
{
int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%eax;"
"bt $0, %%ax;"
"mov %%esi, %%ecx;"
"jnc .+10;"
"add %%eax, %%ecx;"
"lock;"
"cmpxchg %%ecx, (%%rdi);"
"jne .-15"
: "=a" ( rtn )
: "D" ( v ), "S" ( i )
: "%ecx"
);
return rtn;
}
static __inline__
int atomic32_read_and_add_even ( atomic32_t *v, int i )
{
int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%eax;"
"bt $0, %%ax;"
"mov %%esi, %%ecx;"
"jc .+10;"
"add %%eax, %%ecx;"
"lock;"
"cmpxchg %%ecx, (%%rdi);"
"jne .-15"
: "=a" ( rtn )
: "D" ( v ), "S" ( i )
: "%ecx"
);
return rtn;
}
#ifdef __cplusplus
}
#endif
#endif /* _h_atomic32_ */
sra_sdk-2.1.7/interfaces/cc/gcc/x86_64/atomic64.h 0000644 0012213 0011620 00000020711 11476747550 020655 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_atomic64_
#define _h_atomic64_
#ifdef __cplusplus
extern "C" {
#endif
/*
* Make sure gcc doesn't try to be clever and move things around
* on us. We need to use _exactly_ the address the user gave us,
* not some alias that contains the same information.
*/
typedef struct atomic64_t atomic64_t;
struct atomic64_t
{
volatile long int counter;
};
/* int atomic64_read ( const atomic64_t *v ); */
#define atomic64_read( v ) \
( ( v ) -> counter )
/* void atomic64_set ( atomic64_t *v, long int i ); */
#define atomic64_set( v, i ) \
( ( void ) ( ( ( v ) -> counter ) = ( i ) ) )
/* add to v -> counter and return the prior value */
static __inline__ long int atomic64_read_and_add ( atomic64_t *v, long int i )
{
long int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%rax;"
"mov %%rsi, %%rcx;"
"add %%rax, %%rcx;"
"lock;"
"cmpxchg %%rcx, (%%rdi);"
"jne .-11"
: "=a" ( rtn )
: "D" ( v ), "S" ( i )
: "%rcx"
);
return rtn;
}
/* if no read is needed, define the least expensive atomic add */
#define atomic64_add( v, i ) \
atomic64_read_and_add ( v, i )
/* add to v -> counter and return the result */
static __inline__ long int atomic64_add_and_read ( atomic64_t *v, long int i )
{
long int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%rax;"
"mov %%rsi, %%rcx;"
"add %%rax, %%rcx;"
"lock;"
"cmpxchg %%rcx, (%%rdi);"
"jne .-11;"
"mov %%rcx, %%rax"
: "=a" ( rtn )
: "D" ( v ), "S" ( i )
: "%rcx"
);
return rtn;
}
/* just don't try to find out what the result was */
static __inline__ void atomic64_inc ( atomic64_t *v )
{
__asm__ __volatile__
(
"lock;"
"incq %0"
: "=m" ( v -> counter )
: "m" ( v -> counter )
);
}
static __inline__ void atomic64_dec ( atomic64_t *v )
{
__asm__ __volatile__
(
"lock;"
"decq %0"
: "=m" ( v -> counter )
: "m" ( v -> counter )
);
}
/* decrement by one and test result for 0 */
static __inline__ int atomic64_dec_and_test ( atomic64_t *v )
{
unsigned char c;
__asm__ __volatile__
(
"lock;"
"decq %2;"
"sete %%al"
: "=a" ( c ), "=m" ( v -> counter )
: "m" ( v -> counter )
);
return c;
}
/* when atomic64_dec_and_test uses predecrement, you want
postincrement to this function. so it isn't very useful */
static __inline__ int atomic64_inc_and_test ( atomic64_t *v )
{
unsigned char c;
__asm__ __volatile__
(
"lock;"
"incq %2;"
"sete %%al"
: "=a" ( c ), "=m" ( v -> counter )
: "m" ( v -> counter )
);
return c;
}
/* HERE's useful */
#define atomic64_test_and_inc( v ) \
( atomic64_read_and_add ( v, 1L ) == 0 )
static __inline__ long int atomic64_test_and_set ( atomic64_t *v, long int s, long int t )
{
long int rtn;
__asm__ __volatile__
(
"lock;"
"cmpxchg %%rsi,(%%rdi)"
: "=a" ( rtn )
: "D" ( v ), "S" ( s ), "a" ( t )
);
return rtn;
}
/* conditional modifications */
static __inline__
long int atomic64_read_and_add_lt ( atomic64_t *v, long int i, long int t )
{
long int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%rax;"
"cmp %%rdx, %%rax;"
"mov %%rsi, %%rcx;"
"jge .+12;"
"add %%rax, %%rcx;"
"lock;"
"cmpxchg %%rcx, (%%rdi);"
"jne .-16"
: "=a" ( rtn )
: "D" ( v ), "S" ( i ), "d" ( t )
: "%rcx"
);
return rtn;
}
#define atomic64_add_if_lt( v, i, t ) \
( atomic64_read_and_add_lt ( v, i, t ) < ( t ) )
static __inline__
long int atomic64_read_and_add_le ( atomic64_t *v, long int i, long int t )
{
long int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%rax;"
"cmp %%rdx, %%rax;"
"mov %%rsi, %%rcx;"
"jg .+12;"
"add %%rax, %%rcx;"
"lock;"
"cmpxchg %%rcx, (%%rdi);"
"jne .-16"
: "=a" ( rtn )
: "D" ( v ), "S" ( i ), "d" ( t )
: "%rcx"
);
return rtn;
}
#define atomic64_add_if_le( v, i, t ) \
( atomic64_read_and_add_le ( v, i, t ) <= ( t ) )
static __inline__
long int atomic64_read_and_add_eq ( atomic64_t *v, long int i, long int t )
{
long int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%rax;"
"cmp %%rdx, %%rax;"
"mov %%rsi, %%rcx;"
"jne .+12;"
"add %%rax, %%rcx;"
"lock;"
"cmpxchg %%rcx, (%%rdi);"
"jne .-16"
: "=a" ( rtn )
: "D" ( v ), "S" ( i ), "d" ( t )
: "%rcx"
);
return rtn;
}
#define atomic64_add_if_eq( v, i, t ) \
( atomic64_read_and_add_eq ( v, i, t ) == ( t ) )
static __inline__
long int atomic64_read_and_add_ne ( atomic64_t *v, long int i, long int t )
{
long int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%rax;"
"cmp %%rdx, %%rax;"
"mov %%rsi, %%rcx;"
"je .+12;"
"add %%rax, %%rcx;"
"lock;"
"cmpxchg %%rcx, (%%rdi);"
"jne .-16"
: "=a" ( rtn )
: "D" ( v ), "S" ( i ), "d" ( t )
: "%rcx"
);
return rtn;
}
#define atomic64_add_if_ne( v, i, t ) \
( atomic64_read_and_add_ne ( v, i, t ) != ( t ) )
static __inline__
long int atomic64_read_and_add_ge ( atomic64_t *v, long int i, long int t )
{
long int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%rax;"
"cmp %%rdx, %%rax;"
"mov %%rsi, %%rcx;"
"jl .+12;"
"add %%rax, %%rcx;"
"lock;"
"cmpxchg %%rcx, (%%rdi);"
"jne .-16"
: "=a" ( rtn )
: "D" ( v ), "S" ( i ), "d" ( t )
: "%rcx"
);
return rtn;
}
#define atomic64_add_if_ge( v, i, t ) \
( atomic64_read_and_add_ge ( v, i, t ) >= ( t ) )
static __inline__
long int atomic64_read_and_add_gt ( atomic64_t *v, long int i, long int t )
{
long int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%rax;"
"cmp %%rdx, %%rax;"
"mov %%rsi, %%rcx;"
"jle .+12;"
"add %%rax, %%rcx;"
"lock;"
"cmpxchg %%rcx, (%%rdi);"
"jne .-16"
: "=a" ( rtn )
: "D" ( v ), "S" ( i ), "d" ( t )
: "%rcx"
);
return rtn;
}
#define atomic64_add_if_gt( v, i, t ) \
( atomic64_read_and_add_gt ( v, i, t ) > ( t ) )
static __inline__
long int atomic64_read_and_add_odd ( atomic64_t *v, long int i )
{
long int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%rax;"
"bt $0, %%ax;"
"mov %%rsi, %%rcx;"
"jnc .+12;"
"add %%rax, %%rcx;"
"lock;"
"cmpxchg %%rcx, (%%rdi);"
"jne .-18"
: "=a" ( rtn )
: "D" ( v ), "S" ( i )
: "%rcx"
);
return rtn;
}
static __inline__
long int atomic64_read_and_add_even ( atomic64_t *v, long int i )
{
long int rtn;
__asm__ __volatile__
(
"mov (%%rdi), %%rax;"
"bt $0, %%ax;"
"mov %%rsi, %%rcx;"
"jc .+12;"
"add %%rax, %%rcx;"
"lock;"
"cmpxchg %%rcx, (%%rdi);"
"jne .-18"
: "=a" ( rtn )
: "D" ( v ), "S" ( i )
: "%rcx"
);
return rtn;
}
#ifdef __cplusplus
}
#endif
#endif /* _h_atomic64_ */
sra_sdk-2.1.7/interfaces/cc/gcc/x86_64/bitstr.h 0000644 0012213 0011620 00000002727 11476747550 020545 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_bitstr_
#define _h_bitstr_
/* use 64-bit accumulator, 32-bit word size */
#define WRDSIZE 32
#define WRDSHIFT 5
#define WRD uint32_t
#define ACC uint64_t
#define BSWAP( x ) bswap_32 ( x )
#include "../noarch/bitstr.h"
#endif /* _h_bitstr_ */
sra_sdk-2.1.7/interfaces/cc/gcc/x86_64/fmtdef.h 0000644 0012213 0011620 00000003345 11476747550 020500 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_fmtdef_
#define _h_fmtdef_
#if MAC
/* int64_t is still a "long long int" */
#define LD64 "lld"
#define LU64 "llu"
#define LX64 "llX"
#define Lx64 "llx"
/* size_t is now a "long unsigned int" */
#define LUSZ "lu"
#define LXSZ "lX"
#define LxSZ "lx"
#else /* MAC */
/* int64_t is now a "long int" */
#define LD64 "ld"
#define LU64 "lu"
#define LX64 "lX"
#define Lx64 "lx"
/* size_t is now a "long unsigned int" */
#define LUSZ "lu"
#define LXSZ "lX"
#define LxSZ "lx"
#endif /* MAC */
#endif /* _h_fmtdef_ */
sra_sdk-2.1.7/interfaces/cc/gcc/x86_64/strtol.h 0000644 0012213 0011620 00000003745 11645077605 020561 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_strtol_
#define _h_strtol_
#ifndef _h_klib_defs_
#include
#endif
#include
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* strtoi32
* strtou32
* based upon actual usage
*/
#define strtoi32( str, endp, base ) \
( int32_t ) strtol ( str, endp, base )
#define strtou32( str, endp, base ) \
( uint32_t ) strtoul ( str, endp, base )
/*--------------------------------------------------------------------------
* strtoi64
* strtou64
* based upon actual usage
*/
#define strtoi64( str, endp, base ) \
strtol ( str, endp, base )
#define strtou64( str, endp, base ) \
strtoul ( str, endp, base )
#ifdef __cplusplus
}
#endif
#endif /* _h_strtol_ */
sra_sdk-2.1.7/interfaces/cc/gcc/x86_64/byteswap.h 0000644 0012213 0011620 00000004310 11476747550 021062 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_byteswap_
#define _h_byteswap_
#ifdef _BYTESWAP_H
#warning "GNU byteswap.h being used"
#else
#define _BYTESWAP_H 1234
#include
#ifdef __cplusplus
extern "C" {
#endif
/* perform single instruction byte swap */
static __inline__ uint16_t bswap_16 ( uint16_t i )
{
register uint16_t rtn;
__asm__
(
"rorw $8, %w0"
: "=r" ( rtn )
: "0" ( i )
: "cc"
);
return rtn;
}
/* perform single instruction byte swap */
static __inline__ uint32_t bswap_32 ( uint32_t i )
{
register uint32_t rtn;
__asm__
(
"bswap %0"
: "=r" ( rtn )
: "0" ( i )
: "cc"
);
return rtn;
}
/* perform multi-instruction byte swap */
static __inline__ uint64_t bswap_64 ( uint64_t i )
{
register uint64_t rtn;
__asm__
(
"bswap %q0"
: "=r" ( rtn )
: "0" ( i )
: "cc"
);
return rtn;
}
#ifdef __cplusplus
}
#endif
#endif /* _BYTESWAP_H */
#endif /* _h_byteswap_ */
sra_sdk-2.1.7/interfaces/cc/icc/ 0000755 0012213 0011620 00000000000 11477730356 016116 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/cc/icc/compiler.h 0000644 0012213 0011620 00000002542 11476747550 020107 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_compiler_
#define _h_compiler_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* _h_compiler_ */
sra_sdk-2.1.7/interfaces/cc/vc++/ 0000755 0012213 0011620 00000000000 11477730356 016116 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/cc/vc++/i386/ 0000755 0012213 0011620 00000000000 11477730356 016607 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/cc/vc++/i386/arch-impl.h 0000644 0012213 0011620 00000012010 11476747550 020631 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_arch_impl_
#define _h_arch_impl_
#ifndef _h_noarch_arch_impl_
#include "../noarch/arch-impl.h"
#endif
#ifndef _INC_STDLIB
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct int128_t int128_t;
struct int128_t
{
uint64_t lo;
int64_t hi;
};
static __inline
int64_t int128_hi ( const int128_t *self )
{
return self -> hi;
}
static __inline
uint64_t int128_lo ( const int128_t *self )
{
return self -> lo;
}
static __inline
void int128_sethi ( int128_t *self, int64_t i )
{
self -> hi = i;
}
static __inline
void int128_setlo ( int128_t *self, uint64_t i )
{
self -> lo = i;
}
typedef struct uint128_t uint128_t;
struct uint128_t
{
uint64_t lo;
uint64_t hi;
};
static __inline
uint64_t uint128_hi ( const uint128_t *self )
{
return self -> hi;
}
static __inline
uint64_t uint128_lo ( const uint128_t *self )
{
return self -> lo;
}
static __inline
void uint128_sethi ( uint128_t *self, uint64_t i )
{
self -> hi = i;
}
static __inline
void uint128_setlo ( uint128_t *self, uint64_t i )
{
self -> lo = i;
}
static __inline
void int128_add ( int128_t *self, const int128_t *i )
{
uint64_t carry = ( ( const uint32_t* ) self ) [ 0 ] + ( ( const uint32_t* ) i ) [ 0 ];
self -> hi += i -> hi;
carry = ( ( const uint32_t* ) self ) [ 1 ] + ( ( const uint32_t* ) i ) [ 1 ] + ( carry >> 32 );
self -> lo += i -> lo;
self -> hi += carry >> 32;
}
static __inline
void int128_sub ( int128_t *self, const int128_t *i )
{
int carry = i -> lo > self -> lo;
self -> hi -= i -> hi;
self -> lo -= i -> lo;
self -> hi -= carry;
}
static __inline
void int128_sar ( int128_t *self, uint32_t i )
{
if ( i < 64 )
{
self -> lo = ( self -> hi << ( 64 - i ) ) | ( self -> lo >> i );
self -> hi >>= i;
}
else
{
self -> lo = self -> hi >> ( i - 64 );
self -> hi >>= 63;
}
}
static __inline
void int128_shl ( int128_t *self, uint32_t i )
{
if ( i < 64 )
{
self -> hi = ( self -> hi << i ) | ( int64_t ) ( self -> lo >> ( 64 - i ) );
self -> lo <<= i;
}
else
{
self -> hi = ( int64_t ) ( self -> lo << ( i - 64 ) );
self -> lo = 0;
}
}
static __inline
void uint128_and ( uint128_t *self, const uint128_t *i )
{
self -> lo &= i -> lo;
self -> hi &= i -> hi;
}
static __inline
void uint128_or ( uint128_t *self, const uint128_t *i )
{
self -> lo |= i -> lo;
self -> hi |= i -> hi;
}
static __inline
void uint128_orlo ( uint128_t *self, uint64_t i )
{
self -> lo |= i;
}
static __inline
void uint128_xor ( uint128_t *self, const uint128_t *i )
{
self -> lo ^= i -> lo;
self -> hi ^= i -> hi;
}
static __inline
void uint128_not ( uint128_t *self )
{
self -> lo = ~ self -> lo;
self -> hi = ~ self -> hi;
}
static __inline
void uint128_shr ( uint128_t *self, uint32_t i )
{
if ( i < 64 )
{
self -> lo = ( self -> hi << ( 64 - i ) ) | ( self -> lo >> i );
self -> hi >>= i;
}
else
{
self -> lo = self -> hi >> ( i - 64 );
self -> hi >>= 63;
}
}
static __inline
void uint128_shl ( uint128_t *self, uint32_t i )
{
if ( i < 64 )
{
self -> hi = ( self -> hi << i ) | ( self -> lo >> ( 64 - i ) );
self -> lo <<= i;
}
else
{
self -> hi = self -> lo << ( i - 64 );
self -> lo = 0;
}
}
static __inline
void uint128_bswap ( uint128_t *self )
{
uint64_t tmp = _byteswap_uint64 ( self -> lo );
self -> lo = _byteswap_uint64 ( self -> hi );
( ( uint64_t* ) self ) [ 1 ] = tmp;
}
static __inline
void uint128_bswap_copy ( uint128_t *to, const uint128_t *from )
{
to -> lo = _byteswap_uint64 ( from -> hi );
to -> hi = _byteswap_uint64 ( from -> lo );
}
#ifdef __cplusplus
}
#endif
#endif /* _h_arch_impl_ */
sra_sdk-2.1.7/interfaces/cc/vc++/i386/bitstr.h 0000644 0012213 0011620 00000002727 11476747550 020302 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_bitstr_
#define _h_bitstr_
/* use 32-bit accumulator, 16-bit word size */
#define WRDSIZE 16
#define WRDSHIFT 4
#define WRD uint16_t
#define ACC uint32_t
#define BSWAP( x ) bswap_16 ( x )
#include "../noarch/bitstr.h"
#endif /* _h_bitstr_ */
sra_sdk-2.1.7/interfaces/cc/vc++/i386/fmtdef.h 0000644 0012213 0011620 00000003043 11476747550 020230 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_fmtdef_
#define _h_fmtdef_
/* int64_t is "long long int" in 32 bit */
#define LD64 "lld"
#define LU64 "llu"
#define LX64 "llX"
#define Lx64 "llx"
/* size_t is traditionally "unsigned int"
although it should have been "long unsigned int" */
#define LUSZ "u"
#define LXSZ "X"
#define LxSZ "x"
#endif /* _h_fmtdef_ */
sra_sdk-2.1.7/interfaces/cc/vc++/compiler.h 0000644 0012213 0011620 00000003753 11476747550 020114 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_compiler_
#define _h_compiler_
#include
#include
#ifdef __cplusplus
extern "C" {
#endif
static __inline
float roundf( float value_in )
{
return ( value_in < 0 ) ? ceilf ( value_in - 0.5 ) : floorf ( value_in + 0.5 );
}
#define lroundf( x ) (long int)roundf( x )
static __inline
double round( double value_in )
{
return ( value_in < 0 ) ? ceil ( value_in - 0.5 ) : floor ( value_in + 0.5 );
}
typedef double double_t;
#define isnan( x ) _isnan ( x )
static __inline
float truncf( float value_in )
{
return ( value_in < 0 ) ? ceilf( value_in ) : floorf( value_in );
}
static __inline
double trunc( double value_in )
{
return ( value_in < 0 ) ? ceil( value_in ) : floor( value_in );
}
#ifdef __cplusplus
}
#endif
#endif /* _h_compiler_ */
sra_sdk-2.1.7/interfaces/cc/vc++/stdbool.h 0000644 0012213 0011620 00000002744 11476747550 017747 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _STDBOOL_H
#define _STDBOOL_H
/*--------------------------------------------------------------------------
* bool
*/
#ifndef __cplusplus
typedef unsigned char bool;
#undef true
#define true 1
#undef false
#define false 0
#endif
#endif /* _STDBOOL_H */
sra_sdk-2.1.7/interfaces/cc/vc++/stdint.h 0000644 0012213 0011620 00000004220 11476747550 017575 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _STDINT_H
#define _STDINT_H
#ifdef __cplusplus
extern "C" {
#endif
/* perhaps not the best place for this, but it helps reduce the
number of artificial includes for compatibility */
#ifndef __inline__
#define __inline__ __inline
#endif
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#define INT8_MAX _I8_MAX
#define INT8_MIN _I8_MIN
#define UINT8_MAX _UI8_MAX
#define INT16_MAX _I16_MAX
#define INT16_MIN _I16_MIN
#define UINT16_MAX _UI16_MAX
#define INT32_MAX _I32_MAX
#define INT32_MIN _I32_MIN
#define UINT32_MAX _UI32_MAX
#define INT64_MAX _I64_MAX
#define INT64_MIN _I64_MIN
#define UINT64_MAX _UI64_MAX
#ifndef SIZE_T_MAX
#define SIZE_T_MAX ((size_t)(-(1ULL)))
#endif
#define __func__ __FUNCTION__
#ifdef __cplusplus
}
#endif
#endif
sra_sdk-2.1.7/interfaces/cc/vc++/va_copy.h 0000644 0012213 0011620 00000002650 11476747550 017735 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_va_copy_
#define _h_va_copy_
#include
#ifdef __cplusplus
extern "C" {
#endif
#define va_copy( dst, src ) \
( dst ) = ( src )
#ifdef __cplusplus
}
#endif
#endif /* _h_va_copy_ */
sra_sdk-2.1.7/interfaces/cc/vc++/noarch/ 0000755 0012213 0011620 00000000000 11477730356 017370 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/cc/vc++/noarch/arch-impl.h 0000644 0012213 0011620 00000005776 11476747550 021437 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_noarch_arch_impl_
#define _h_noarch_arch_impl_
#include
#ifdef __cplusplus
extern "C" {
#endif
/* this table is very simple to calculate
but simpler yet to use for lookup */
static const int8_t lsbit_map [] =
{
-1, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
};
static __inline
int16_t uint16_lsbit ( uint16_t self )
{
/* detect no bits are set */
if ( self == 0 )
return -1;
/* detect bits set in lower byte */
if ( ( uint8_t ) self != 0 )
return lsbit_map [ ( uint8_t ) self ];
/* return bit set in upper byte */
return lsbit_map [ self >> 8 ] + 8;
}
static __inline
int32_t uint32_lsbit ( uint32_t self )
{
/* detect no bits are set */
if ( self == 0 )
return -1;
/* detect bits set in lower word */
if ( ( uint16_t ) self != 0 )
return uint16_lsbit ( ( uint16_t ) self );
/* return bit set in upper word */
return uint16_lsbit ( self >> 16 ) + 16;
}
#ifdef __cplusplus
}
#endif
#endif /* _h_noarch_arch_impl_ */
sra_sdk-2.1.7/interfaces/cc/vc++/noarch/bitstr.h 0000644 0012213 0011620 00000040665 11476747550 021066 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_noarch_bitstr_
#define _h_noarch_bitstr_
#ifndef _h_bitstr_
#error "don't include directly - use "
#endif
#ifndef _h_klib_defs_
#include
#endif
#include
#ifdef __cplusplus
extern "C" {
#endif
/* bitcpy
* copy a string of bits from source to dest
*
* both source and dest may have non-byte aligned pointers
* the number of bits to copy need not be byte aligned
*
* depending upon architecture and OS conventions, the word
* size may be adjusted to 1, 2, or 4 bytes, where the base
* pointers are always word aligned.
*
* bits in memory are always treated as big-endian, meaning
* that on multi-byte fetches and stores, we perform byte-swapping
* if there are shifts or masks
*/
static __inline
void bitcpy ( void *dbase, bitsz_t doff, const void *sbase, bitsz_t soff, bitsz_t sz )
{
/* noop if sz == 0 */
if ( sz != 0 )
{
/* loop counter and destination word count */
size_t i, dcountz;
/* left & right masks and working register */
WRD lmask, rmask, reg;
/* produce word-aligned pointers */
#if WRDSIZE == 8
/* 1-4. all at once */
WRD *dst = ( WRD* ) dbase + ( doff >> WRDSHIFT );
const WRD *src = ( const WRD* ) sbase + ( soff >> WRDSHIFT );
#else
/* 1. capture word alignment adjustment */
size_t dadjust = ( size_t ) dbase & ( WRDSIZE / 8 - 1 );
size_t sadjust = ( size_t ) sbase & ( WRDSIZE / 8 - 1 );
/* 2. create word-aligned pointers */
WRD *dst = ( WRD* ) ( ( size_t ) dbase - dadjust );
const WRD *src = ( const WRD* ) ( ( size_t ) sbase - sadjust );
/* 3. incorporate alignment adjustment into offset bits */
doff += dadjust << 3;
soff += sadjust << 3;
/* 4. readjust pointers based upon offset */
dst += doff >> WRDSHIFT;
src += soff >> WRDSHIFT;
#endif
/* 5. restate offsets */
doff &= ( WRDSIZE - 1 );
soff &= ( WRDSIZE - 1 );
/* calculate number of words - 1 in dst */
dcountz = ( doff + sz + ( WRDSIZE - 1 ) - WRDSIZE ) >> WRDSHIFT;
/* calculate masks */
lmask = rmask = ~ 0;
lmask >>= doff;
rmask >>= ( doff + sz ) & ( WRDSIZE - 1 );
if ( ( WRD ) ( rmask + 1 ) == 0 )
rmask = 0;
/* prime register with masked dst [ 0 ] */
reg = BSWAP ( dst [ 0 ] ) & ~ lmask;
/* if source and destination are aligned */
if ( doff == soff )
{
/* merge src [ 0 ] into reg through mask */
reg |= BSWAP ( src [ 0 ] ) & lmask;
#if WRDSIZE > 8
/* straight copies don't need byteswap
other than on first and last words
put first word back into little-endian
for remainder of loop */
if ( dcountz > 0 )
{
reg = BSWAP ( reg );
#endif
/* aligned buffers have n:n word ratio */
for ( i = 0; i < dcountz; )
{
dst [ i ] = reg;
reg = src [ ++ i ];
}
#if WRDSIZE > 8
/* revert to big-endian */
reg = BSWAP ( reg );
}
#endif
}
/* shifting alignment */
else
{
/* source count may differ from dest count */
size_t scountz = ( soff + sz + ( WRDSIZE - 1 ) - WRDSIZE ) >> WRDSHIFT;
/* use double-word accumulator */
ACC acc = BSWAP ( src [ 0 ] );
/* shift amount */
int shift = ( int ) doff - ( int ) soff;
if ( shift > 0 )
{
/* take only valid bits in shifted initial src */
reg |= ( WRD ) ( acc >> shift ) & lmask;
/* because "shift" > 0, we know "dcountz" >= "scountz" */
for ( acc <<= WRDSIZE, i = 0; i < scountz; acc <<= WRDSIZE )
{
dst [ i ] = BSWAP ( reg );
acc |= BSWAP ( src [ ++ i ] );
reg = ( WRD ) ( acc >> shift );
}
/* if "dcountz" > "scountz" */
if ( i < dcountz )
{
dst [ i ] = BSWAP ( reg );
reg = ( WRD ) ( acc >> shift );
}
}
else
{
/* need single word read-ahead and right-shift */
shift += WRDSIZE;
/* because "shift" was < 0, we know "dcountz" <= "scountz" */
for ( acc <<= WRDSIZE, i = 0; i < dcountz; acc <<= WRDSIZE )
{
acc |= BSWAP ( src [ i + 1 ] );
reg |= ( WRD ) ( acc >> shift ) & lmask;
dst [ i ++ ] = BSWAP ( reg );
lmask = ~ 0;
reg = 0;
}
/* if "dcountz" < "scountz" */
if ( i < scountz )
acc |= BSWAP ( src [ scountz ] );
reg |= ( WRD ) ( acc >> shift ) & lmask;
}
}
/* mask off unused bytes from src */
reg &= ~ rmask;
/* bring in saved bits from dst */
reg |= BSWAP ( dst [ dcountz ] ) & rmask;
/* write out last word */
dst [ dcountz ] = BSWAP ( reg );
}
}
/* bitcmp
* performs bitwise a - b, returning result as int
* result value has no meaning, only sign
* where < 0 means a < b, > 0 means a > b, and 0 means a == b
*
* since the comparison produces a tri-state indicator of
* relative magnitude, the order of "a" and "b" is important.
* furthermore, the difference operator must be evaluated
* left to right, because the result indicates more than
* equality.
*
* see bitcpy for general word alignment information
*/
static __inline
int bitcmp ( const void *abase, bitsz_t aoff, const void *bbase, bitsz_t boff, bitsz_t sz )
{
int diff = 0;
if ( sz != 0 )
{
/* loop counter and left word count */
size_t i, lcountz;
/* left & right masks and working registers */
WRD lmask, rmask, lreg, rreg;
/* produce word-aligned pointers */
#if WRDSIZE == 8
/* 1-4. all at once */
const WRD *left = ( const WRD* ) abase + ( aoff >> WRDSHIFT );
const WRD *right = ( const WRD* ) bbase + ( boff >> WRDSHIFT );
#else
/* 1. capture word alignment adjustment */
size_t aadjust = ( size_t ) abase & ( WRDSIZE / 8 - 1 );
size_t badjust = ( size_t ) bbase & ( WRDSIZE / 8 - 1 );
/* 2. create word-aligned pointers */
const WRD *left = ( const WRD* ) ( ( size_t ) abase - aadjust );
const WRD *right = ( const WRD* ) ( ( size_t ) bbase - badjust );
/* 3. incorporate alignment adjustment into offset bits */
aoff += aadjust << 3;
boff += badjust << 3;
/* 4. readjust pointers based upon offset */
left += aoff >> WRDSHIFT;
right += boff >> WRDSHIFT;
#endif
/* 5. restate offsets */
aoff &= ( WRDSIZE - 1 );
boff &= ( WRDSIZE - 1 );
/* calculate number of words - 1 in left
since we know a-priori that "sz" > 0, we
know that the left and right counts must be
at least 1. our loops treat the last word
specially, so calculate a loop counter that
excludes the last word */
lcountz = ( aoff + sz + ( WRDSIZE - 1 ) - WRDSIZE ) >> WRDSHIFT;
/* calculate masks */
lmask = rmask = ~ 0;
lmask >>= aoff;
rmask >>= ( aoff + sz ) & ( WRDSIZE - 1 );
if ( ( WRD ) ( rmask + 1 ) == 0 )
rmask = 0;
/* significant bits from left [ 0 ] */
lreg = BSWAP ( left [ 0 ] ) & lmask;
/* if source and destination are aligned */
if ( aoff == boff )
{
/* test against right bits through mask */
rreg = BSWAP ( right [ 0 ] ) & lmask;
/* produce a difference of all but the last
aligned word, where initial word has been
left-masked. the last word is tested below. */
for ( i = 1; i <= lcountz; ++ i )
{
diff = ( int ) lreg - ( int ) rreg;
if ( diff != 0 )
return diff;
/* byte-swapping occurs on little-endian architectures */
lreg = BSWAP ( left [ i ] );
rreg = BSWAP ( right [ i ] );
}
/* fall out to end for masked comparison of last word */
}
/* shifting alignment */
else
{
/* right count may differ from left count
since alignments differ, the span of "sz"
bits may hit a different number of words in
the left array than in the right. */
size_t rcountz = ( boff + sz + ( WRDSIZE - 1 ) - WRDSIZE ) >> WRDSHIFT;
/* use double-word accumulator
note that the extra bits get ignored */
ACC acc = BSWAP ( right [ 0 ] );
/* shift amount: positive if "b" needs to be right shifted.
NOTE - since the comparison must be successively performed
from left to right ( see above ), shifting is ALWAYS toward
right, making for special handling when "shift" < 0 ( see below ) */
int shift = ( int ) aoff - ( int ) boff;
if ( shift > 0 )
{
/* initial word from right operand, aligned with left */
rreg = ( WRD ) ( acc >> shift ) & lmask;
/* "shift" > 0 means "lcountz" >= "rcountz" */
for ( acc <<= WRDSIZE, i = 1; i <= rcountz; acc <<= WRDSIZE, ++ i )
{
/* compare words at i-1 */
diff = ( int ) lreg - ( int ) rreg;
if ( diff != 0 )
return diff;
/* accumulate next word from right operand */
acc |= BSWAP ( right [ i ] );
/* bring in next word from left operand */
lreg = BSWAP ( left [ i ] );
/* produce aligned word from right operand */
rreg = ( WRD ) ( acc >> shift );
}
/* if there is one more word in left */
if ( lcountz > rcountz )
{
/* compare penultimate */
diff = ( int ) lreg - ( int ) rreg;
if ( diff != 0 )
return diff;
/* get last word in left */
lreg = BSWAP ( left [ lcountz ] );
/* last word from right is already in "acc" */
rreg = ( WRD ) ( acc >> shift );
}
/* fall out to end for masked comparison of last word */
}
else
{
/* since all shifts must be toward right ( due to left to right
comparison ), this alignment will require a pre-fetch from
right operand into accumulator, and adjusting the negative
shift amount to a positive right-shift. */
shift += WRDSIZE;
/* since "shift" was negative, we know "lcountz" <= "rcountz",
so use "lcountz" as loop limit. pre-shift "acc" as loop init */
for ( acc <<= WRDSIZE, i = 1; i <= lcountz; acc <<= WRDSIZE, ++ i )
{
/* accumulate next word from right operand */
acc |= BSWAP ( right [ i ] );
/* produce aligned word from right operand */
rreg = ( WRD ) ( acc >> shift ) & lmask;
/* now test against left */
diff = ( int ) lreg - ( int ) rreg;
if ( diff != 0 )
return diff;
/* bring in next word from left operand */
lreg = BSWAP ( left [ i ] );
/* no more left mask */
lmask = ~ 0;
}
/* if there is one more word in right */
if ( lcountz < rcountz )
acc |= BSWAP ( right [ rcountz ] );
/* produce "rreg" from "acc" */
rreg = ( WRD ) ( acc >> shift ) & lmask;
/* fall out to end for masked comparison of last word */
}
}
/* mask off unused bytes from right */
lreg &= ~ rmask;
rreg &= ~ rmask;
/* perform final comparison */
diff = ( int ) lreg - ( int ) rreg;
}
return diff;
}
#ifdef __cplusplus
}
#endif
#endif /* _h_noarch_bitstr_ */
sra_sdk-2.1.7/interfaces/cc/vc++/x86_64/ 0000755 0012213 0011620 00000000000 11477730356 017054 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/cc/vc++/x86_64/arch-impl.h 0000644 0012213 0011620 00000007546 11476747550 021120 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_arch_impl_
#define _h_arch_impl_
#ifndef _h_noarch_arch_impl_
#include "../noarch/arch-impl.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef __int128 int128_t;
static __inline
int64_t int128_hi ( const int128_t *self )
{
return ( ( const int64_t* ) self ) [ 1 ];
}
static __inline
uint64_t int128_lo ( const int128_t *self )
{
return ( ( const uint64_t* ) self ) [ 0 ];
}
static __inline
void int128_sethi ( int128_t *self, int64_t i )
{
( ( int64_t* ) self ) [ 1 ] = i;
}
static __inline
void int128_setlo ( int128_t *self, uint64_t i )
{
( ( uint64_t* ) self ) [ 0 ] = i;
}
typedef __uint128 uint128_t;
static __inline
uint64_t uint128_hi ( const uint128_t *self )
{
return ( ( const uint64_t* ) self ) [ 1 ];
}
static __inline
uint64_t uint128_lo ( const uint128_t *self )
{
return ( ( const uint64_t* ) self ) [ 0 ];
}
static __inline
void uint128_sethi ( uint128_t *self, uint64_t i )
{
( ( uint64_t* ) self ) [ 1 ] = i;
}
static __inline
void uint128_setlo ( uint128_t *self, uint64_t i )
{
( ( uint64_t* ) self ) [ 0 ] = i;
}
static __inline
void int128_add ( int128_t *self, const int128_t *i )
{
* self += * i;
}
static __inline
void int128_sub ( int128_t *self, const int128_t *i )
{
* self -= * i;
}
static __inline
void int128_sar ( int128_t *self, uint32_t i )
{
* self >>= i;
}
static __inline
void int128_shl ( int128_t *self, uint32_t i )
{
* self << i;
}
static __inline
void uint128_and ( uint128_t *self, const uint128_t *i )
{
* self &= * i;
}
static __inline
void uint128_or ( uint128_t *self, const uint128_t *i )
{
* self |= * i;
}
static __inline
void uint128_orlo ( uint128_t *self, uint64_t i )
{
( ( uint64_t* ) self ) [ 0 ] |= i;
}
static __inline
void uint128_xor ( uint128_t *self, const uint128_t *i )
{
* self ^= * i;
}
static __inline
void uint128_not ( uint128_t *self )
{
* self = ~ * self;
}
static __inline
void uint128_shr ( uint128_t *self, uint32_t i )
{
* self >>= i;
}
static __inline
void uint128_shl ( uint128_t *self, uint32_t i )
{
* self <<= i;
}
static __inline
void uint128_bswap ( uint128_t *self )
{
uint64_t tmp = _byteswap_uint64 ( ( ( const uint64_t* ) self ) [ 0 ] );
( ( uint64_t* ) self ) [ 0 ] = _byteswap_uint64 ( ( ( const uint64_t* ) self ) [ 1 ] );
( ( uint64_t* ) self ) [ 1 ] = tmp;
}
static __inline
void uint128_bswap_copy ( uint128_t *to, const uint128_t *from )
{
( ( uint64_t* ) to ) [ 0 ] = _byteswap_uint64 ( ( ( const uint64_t* ) from ) [ 1 ] );
( ( uint64_t* ) to ) [ 1 ] = _byteswap_uint64 ( ( ( const uint64_t* ) from ) [ 0 ] );
}
#ifdef __cplusplus
}
#endif
#endif /* _h_arch_impl_ */
sra_sdk-2.1.7/interfaces/cc/vc++/x86_64/bitstr.h 0000644 0012213 0011620 00000002727 11476747550 020547 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_bitstr_
#define _h_bitstr_
/* use 64-bit accumulator, 32-bit word size */
#define WRDSIZE 32
#define WRDSHIFT 5
#define WRD uint32_t
#define ACC uint64_t
#define BSWAP( x ) bswap_32 ( x )
#include "../noarch/bitstr.h"
#endif /* _h_bitstr_ */
sra_sdk-2.1.7/interfaces/cc/vc++/x86_64/fmtdef.h 0000644 0012213 0011620 00000002742 11476747550 020502 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_fmtdef_
#define _h_fmtdef_
/* int64_t is now a "long int" */
#define LD64 "ld"
#define LU64 "lu"
#define LX64 "lX"
#define Lx64 "lx"
/* size_t is now a "long unsigned int" */
#define LUSZ "lu"
#define LXSZ "lX"
#define LxSZ "lx"
#endif /* _h_fmtdef_ */
sra_sdk-2.1.7/interfaces/ext/ 0000755 0012213 0011620 00000000000 11625222615 015560 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/ext/bzlib.h 0000644 0012213 0011620 00000014145 11476747550 017056 0 ustar rodarmer trace
/*-------------------------------------------------------------*/
/*--- Public header file for the library. ---*/
/*--- bzlib.h ---*/
/*-------------------------------------------------------------*/
/* ------------------------------------------------------------------
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
bzip2/libbzip2 version 1.0.6 of 6 September 2010
Copyright (C) 1996-2010 Julian Seward
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
This program is released under the terms of the license contained
in the file LICENSE.
------------------------------------------------------------------ */
#ifndef _BZLIB_H
#define _BZLIB_H
#ifdef __cplusplus
extern "C" {
#endif
#define BZ_RUN 0
#define BZ_FLUSH 1
#define BZ_FINISH 2
#define BZ_OK 0
#define BZ_RUN_OK 1
#define BZ_FLUSH_OK 2
#define BZ_FINISH_OK 3
#define BZ_STREAM_END 4
#define BZ_SEQUENCE_ERROR (-1)
#define BZ_PARAM_ERROR (-2)
#define BZ_MEM_ERROR (-3)
#define BZ_DATA_ERROR (-4)
#define BZ_DATA_ERROR_MAGIC (-5)
#define BZ_IO_ERROR (-6)
#define BZ_UNEXPECTED_EOF (-7)
#define BZ_OUTBUFF_FULL (-8)
#define BZ_CONFIG_ERROR (-9)
typedef
struct {
char *next_in;
unsigned int avail_in;
unsigned int total_in_lo32;
unsigned int total_in_hi32;
char *next_out;
unsigned int avail_out;
unsigned int total_out_lo32;
unsigned int total_out_hi32;
void *state;
void *(*bzalloc)(void *,int,int);
void (*bzfree)(void *,void *);
void *opaque;
}
bz_stream;
#ifndef BZ_IMPORT
#define BZ_EXPORT
#endif
#ifndef BZ_NO_STDIO
/* Need a definitition for FILE */
#include
#endif
#ifdef _WIN32
# include
# ifdef small
/* windows.h define small to char */
# undef small
# endif
# ifdef BZ_EXPORT
# define BZ_API(func) WINAPI func
# define BZ_EXTERN extern
# else
/* import windows dll dynamically */
# define BZ_API(func) (WINAPI * func)
# define BZ_EXTERN
# endif
#else
# define BZ_API(func) func
# define BZ_EXTERN extern
#endif
/*-- Core (low-level) library functions --*/
BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
bz_stream* strm,
int blockSize100k,
int verbosity,
int workFactor
);
BZ_EXTERN int BZ_API(BZ2_bzCompress) (
bz_stream* strm,
int action
);
BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
bz_stream* strm
);
BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
bz_stream *strm,
int verbosity,
int small
);
BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
bz_stream* strm
);
BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
bz_stream *strm
);
/*-- High(er) level library functions --*/
#ifndef BZ_NO_STDIO
#define BZ_MAX_UNUSED 5000
typedef void BZFILE;
BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
int* bzerror,
FILE* f,
int verbosity,
int small,
void* unused,
int nUnused
);
BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
int* bzerror,
BZFILE* b
);
BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
int* bzerror,
BZFILE* b,
void** unused,
int* nUnused
);
BZ_EXTERN int BZ_API(BZ2_bzRead) (
int* bzerror,
BZFILE* b,
void* buf,
int len
);
BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
int* bzerror,
FILE* f,
int blockSize100k,
int verbosity,
int workFactor
);
BZ_EXTERN void BZ_API(BZ2_bzWrite) (
int* bzerror,
BZFILE* b,
void* buf,
int len
);
BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
int* bzerror,
BZFILE* b,
int abandon,
unsigned int* nbytes_in,
unsigned int* nbytes_out
);
BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
int* bzerror,
BZFILE* b,
int abandon,
unsigned int* nbytes_in_lo32,
unsigned int* nbytes_in_hi32,
unsigned int* nbytes_out_lo32,
unsigned int* nbytes_out_hi32
);
#endif
/*-- Utility functions --*/
BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
char* dest,
unsigned int* destLen,
char* source,
unsigned int sourceLen,
int blockSize100k,
int verbosity,
int workFactor
);
BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
char* dest,
unsigned int* destLen,
char* source,
unsigned int sourceLen,
int small,
int verbosity
);
/*--
Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
to support better zlib compatibility.
This code is not _officially_ part of libbzip2 (yet);
I haven't tested it, documented it, or considered the
threading-safeness of it.
If this code breaks, please contact both Yoshioka and me.
--*/
BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
void
);
#ifndef BZ_NO_STDIO
BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
const char *path,
const char *mode
);
BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
int fd,
const char *mode
);
BZ_EXTERN int BZ_API(BZ2_bzread) (
BZFILE* b,
void* buf,
int len
);
BZ_EXTERN int BZ_API(BZ2_bzwrite) (
BZFILE* b,
void* buf,
int len
);
BZ_EXTERN int BZ_API(BZ2_bzflush) (
BZFILE* b
);
BZ_EXTERN void BZ_API(BZ2_bzclose) (
BZFILE* b
);
BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
BZFILE *b,
int *errnum
);
#endif
#ifdef __cplusplus
}
#endif
#endif
/*-------------------------------------------------------------*/
/*--- end bzlib.h ---*/
/*-------------------------------------------------------------*/
sra_sdk-2.1.7/interfaces/ext/magic.h 0000644 0012213 0011620 00000007462 11476747550 017040 0 ustar rodarmer trace /*
* Copyright (c) Christos Zoulas 2003.
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice immediately at the beginning of the file, without modification,
* this list of conditions, and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _MAGIC_H
#define _MAGIC_H
#include
#define MAGIC_NONE 0x000000 /* No flags */
#define MAGIC_DEBUG 0x000001 /* Turn on debugging */
#define MAGIC_SYMLINK 0x000002 /* Follow symlinks */
#define MAGIC_COMPRESS 0x000004 /* Check inside compressed files */
#define MAGIC_DEVICES 0x000008 /* Look at the contents of devices */
#define MAGIC_MIME_TYPE 0x000010 /* Return the MIME type */
#define MAGIC_CONTINUE 0x000020 /* Return all matches */
#define MAGIC_CHECK 0x000040 /* Print warnings to stderr */
#define MAGIC_PRESERVE_ATIME 0x000080 /* Restore access time on exit */
#define MAGIC_RAW 0x000100 /* Don't translate unprintable chars */
#define MAGIC_ERROR 0x000200 /* Handle ENOENT etc as real errors */
#define MAGIC_MIME_ENCODING 0x000400 /* Return the MIME encoding */
#define MAGIC_MIME (MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
#define MAGIC_APPLE 0x000800 /* Return the Apple creator and type */
#define MAGIC_NO_CHECK_COMPRESS 0x001000 /* Don't check for compressed files */
#define MAGIC_NO_CHECK_TAR 0x002000 /* Don't check for tar files */
#define MAGIC_NO_CHECK_SOFT 0x004000 /* Don't check magic entries */
#define MAGIC_NO_CHECK_APPTYPE 0x008000 /* Don't check application type */
#define MAGIC_NO_CHECK_ELF 0x010000 /* Don't check for elf details */
#define MAGIC_NO_CHECK_TEXT 0x020000 /* Don't check for text files */
#define MAGIC_NO_CHECK_CDF 0x040000 /* Don't check for cdf files */
#define MAGIC_NO_CHECK_TOKENS 0x100000 /* Don't check tokens */
#define MAGIC_NO_CHECK_ENCODING 0x200000 /* Don't check text encodings */
/* Defined for backwards compatibility (renamed) */
#define MAGIC_NO_CHECK_ASCII MAGIC_NO_CHECK_TEXT
/* Defined for backwards compatibility; do nothing */
#define MAGIC_NO_CHECK_FORTRAN 0x000000 /* Don't check ascii/fortran */
#define MAGIC_NO_CHECK_TROFF 0x000000 /* Don't check ascii/troff */
#ifdef __cplusplus
extern "C" {
#endif
typedef struct magic_set *magic_t;
magic_t magic_open(int);
void magic_close(magic_t);
const char *magic_getpath(const char *, int);
const char *magic_file(magic_t, const char *);
const char *magic_descriptor(magic_t, int);
const char *magic_buffer(magic_t, const void *, size_t);
const char *magic_error(magic_t);
int magic_setflags(magic_t, int);
int magic_load(magic_t, const char *);
int magic_compile(magic_t, const char *);
int magic_check(magic_t, const char *);
int magic_errno(magic_t);
#ifdef __cplusplus
};
#endif
#endif /* _MAGIC_H */
sra_sdk-2.1.7/interfaces/ext/regex.h 0000644 0012213 0011620 00000051417 11476747550 017071 0 ustar rodarmer trace /* Definitions for data structures and routines for the regular
expression library.
Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003,2005,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _REGEX_H
#define _REGEX_H 1
#include
/* Allow the use in C++ code. */
#ifdef __cplusplus
extern "C" {
#endif
/* The following two types have to be signed and unsigned integer type
wide enough to hold a value of a pointer. For most ANSI compilers
ptrdiff_t and size_t should be likely OK. Still size of these two
types is 2 for Microsoft C. Ugh... */
typedef long int s_reg_t;
typedef unsigned long int active_reg_t;
/* The following bits are used to determine the regexp syntax we
recognize. The set/not-set meanings are chosen so that Emacs syntax
remains the value 0. The bits are given in alphabetical order, and
the definitions shifted by one from the previous bit; thus, when we
add or remove a bit, only one other definition need change. */
typedef unsigned long int reg_syntax_t;
/* If this bit is not set, then \ inside a bracket expression is literal.
If set, then such a \ quotes the following character. */
#define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
/* If this bit is not set, then + and ? are operators, and \+ and \? are
literals.
If set, then \+ and \? are operators and + and ? are literals. */
#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
/* If this bit is set, then character classes are supported. They are:
[:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
[:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
If not set, then character classes are not supported. */
#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
/* If this bit is set, then ^ and $ are always anchors (outside bracket
expressions, of course).
If this bit is not set, then it depends:
^ is an anchor if it is at the beginning of a regular
expression or after an open-group or an alternation operator;
$ is an anchor if it is at the end of a regular expression, or
before a close-group or an alternation operator.
This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
POSIX draft 11.2 says that * etc. in leading positions is undefined.
We already implemented a previous draft which made those constructs
invalid, though, so we haven't changed the code back. */
#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
/* If this bit is set, then special characters are always special
regardless of where they are in the pattern.
If this bit is not set, then special characters are special only in
some contexts; otherwise they are ordinary. Specifically,
* + ? and intervals are only special when not after the beginning,
open-group, or alternation operator. */
#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
/* If this bit is set, then *, +, ?, and { cannot be first in an re or
immediately after an alternation or begin-group operator. */
#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
/* If this bit is set, then . matches newline.
If not set, then it doesn't. */
#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
/* If this bit is set, then . doesn't match NUL.
If not set, then it does. */
#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
/* If this bit is set, nonmatching lists [^...] do not match newline.
If not set, they do. */
#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
/* If this bit is set, either \{...\} or {...} defines an
interval, depending on RE_NO_BK_BRACES.
If not set, \{, \}, {, and } are literals. */
#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
/* If this bit is set, +, ? and | aren't recognized as operators.
If not set, they are. */
#define RE_LIMITED_OPS (RE_INTERVALS << 1)
/* If this bit is set, newline is an alternation operator.
If not set, newline is literal. */
#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
/* If this bit is set, then `{...}' defines an interval, and \{ and \}
are literals.
If not set, then `\{...\}' defines an interval. */
#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
/* If this bit is set, (...) defines a group, and \( and \) are literals.
If not set, \(...\) defines a group, and ( and ) are literals. */
#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
/* If this bit is set, then \ matches .
If not set, then \ is a back-reference. */
#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
/* If this bit is set, then | is an alternation operator, and \| is literal.
If not set, then \| is an alternation operator, and | is literal. */
#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
/* If this bit is set, then an ending range point collating higher
than the starting range point, as in [z-a], is invalid.
If not set, then when ending range point collates higher than the
starting range point, the range is ignored. */
#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
/* If this bit is set, then an unmatched ) is ordinary.
If not set, then an unmatched ) is invalid. */
#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
/* If this bit is set, succeed as soon as we match the whole pattern,
without further backtracking. */
#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
/* If this bit is set, do not process the GNU regex operators.
If not set, then the GNU regex operators are recognized. */
#define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
/* If this bit is set, turn on internal regex debugging.
If not set, and debugging was on, turn it off.
This only works if regex.c is compiled -DDEBUG.
We define this bit always, so that all that's needed to turn on
debugging is to recompile regex.c; the calling code can always have
this bit set, and it won't affect anything in the normal case. */
#define RE_DEBUG (RE_NO_GNU_OPS << 1)
/* If this bit is set, a syntactically invalid interval is treated as
a string of ordinary characters. For example, the ERE 'a{1' is
treated as 'a\{1'. */
#define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
/* If this bit is set, then ignore case when matching.
If not set, then case is significant. */
#define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only
for ^, because it is difficult to scan the regex backwards to find
whether ^ should be special. */
#define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
/* If this bit is set, then \{ cannot be first in an bre or
immediately after an alternation or begin-group operator. */
#define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1)
/* If this bit is set, then no_sub will be set to 1 during
re_compile_pattern. */
#define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
/* This global variable defines the particular regexp syntax to use (for
some interfaces). When a regexp is compiled, the syntax used is
stored in the pattern buffer, so changing this does not affect
already-compiled regexps. */
extern reg_syntax_t re_syntax_options;
/* Define combinations of the above bits for the standard possibilities.
(The [[[ comments delimit what gets put into the Texinfo file, so
don't delete them!) */
/* [[[begin syntaxes]]] */
#define RE_SYNTAX_EMACS 0
#define RE_SYNTAX_AWK \
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
| RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \
| RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
#define RE_SYNTAX_GNU_AWK \
((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \
& ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS \
| RE_CONTEXT_INVALID_OPS ))
#define RE_SYNTAX_POSIX_AWK \
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
| RE_INTERVALS | RE_NO_GNU_OPS)
#define RE_SYNTAX_GREP \
(RE_BK_PLUS_QM | RE_CHAR_CLASSES \
| RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
| RE_NEWLINE_ALT)
#define RE_SYNTAX_EGREP \
(RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
| RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
| RE_NEWLINE_ALT | RE_NO_BK_PARENS \
| RE_NO_BK_VBAR)
#define RE_SYNTAX_POSIX_EGREP \
(RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES \
| RE_INVALID_INTERVAL_ORD)
/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
/* Syntax bits common to both basic and extended POSIX regex syntax. */
#define _RE_SYNTAX_POSIX_COMMON \
(RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
| RE_INTERVALS | RE_NO_EMPTY_RANGES)
#define RE_SYNTAX_POSIX_BASIC \
(_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP)
/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
isn't minimal, since other operators, such as \`, aren't disabled. */
#define RE_SYNTAX_POSIX_MINIMAL_BASIC \
(_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
#define RE_SYNTAX_POSIX_EXTENDED \
(_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
| RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
| RE_NO_BK_PARENS | RE_NO_BK_VBAR \
| RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD)
/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is
removed and RE_NO_BK_REFS is added. */
#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
(_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
| RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
| RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
/* [[[end syntaxes]]] */
/* Maximum number of duplicates an interval can allow. Some systems
(erroneously) define this in other header files, but we want our
value, so remove any previous define. */
#ifdef RE_DUP_MAX
# undef RE_DUP_MAX
#endif
/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */
#define RE_DUP_MAX (0x7fff)
/* POSIX `cflags' bits (i.e., information for `regcomp'). */
/* If this bit is set, then use extended regular expression syntax.
If not set, then use basic regular expression syntax. */
#define REG_EXTENDED 1
/* If this bit is set, then ignore case when matching.
If not set, then case is significant. */
#define REG_ICASE (REG_EXTENDED << 1)
/* If this bit is set, then anchors do not match at newline
characters in the string.
If not set, then anchors do match at newlines. */
#define REG_NEWLINE (REG_ICASE << 1)
/* If this bit is set, then report only success or fail in regexec.
If not set, then returns differ between not matching and errors. */
#define REG_NOSUB (REG_NEWLINE << 1)
/* POSIX `eflags' bits (i.e., information for regexec). */
/* If this bit is set, then the beginning-of-line operator doesn't match
the beginning of the string (presumably because it's not the
beginning of a line).
If not set, then the beginning-of-line operator does match the
beginning of the string. */
#define REG_NOTBOL 1
/* Like REG_NOTBOL, except for the end-of-line. */
#define REG_NOTEOL (1 << 1)
/* Use PMATCH[0] to delimit the start and end of the search in the
buffer. */
#define REG_STARTEND (1 << 2)
/* If any error codes are removed, changed, or added, update the
`re_error_msg' table in regex.c. */
typedef enum
{
#ifdef _XOPEN_SOURCE
REG_ENOSYS = -1, /* This will never happen for this implementation. */
#endif
REG_NOERROR = 0, /* Success. */
REG_NOMATCH, /* Didn't find a match (for regexec). */
/* POSIX regcomp return error codes. (In the order listed in the
standard.) */
REG_BADPAT, /* Invalid pattern. */
REG_ECOLLATE, /* Inalid collating element. */
REG_ECTYPE, /* Invalid character class name. */
REG_EESCAPE, /* Trailing backslash. */
REG_ESUBREG, /* Invalid back reference. */
REG_EBRACK, /* Unmatched left bracket. */
REG_EPAREN, /* Parenthesis imbalance. */
REG_EBRACE, /* Unmatched \{. */
REG_BADBR, /* Invalid contents of \{\}. */
REG_ERANGE, /* Invalid range end. */
REG_ESPACE, /* Ran out of memory. */
REG_BADRPT, /* No preceding re for repetition op. */
/* Error codes we've added. */
REG_EEND, /* Premature end. */
REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
} reg_errcode_t;
/* This data structure represents a compiled pattern. Before calling
the pattern compiler, the fields `buffer', `allocated', `fastmap',
`translate', and `no_sub' can be set. After the pattern has been
compiled, the `re_nsub' field is available. All other fields are
private to the regex routines. */
#ifndef RE_TRANSLATE_TYPE
# define RE_TRANSLATE_TYPE unsigned char *
#endif
struct re_pattern_buffer
{
/* Space that holds the compiled pattern. It is declared as
`unsigned char *' because its elements are sometimes used as
array indexes. */
unsigned char *buffer;
/* Number of bytes to which `buffer' points. */
unsigned long int allocated;
/* Number of bytes actually used in `buffer'. */
unsigned long int used;
/* Syntax setting with which the pattern was compiled. */
reg_syntax_t syntax;
/* Pointer to a fastmap, if any, otherwise zero. re_search uses the
fastmap, if there is one, to skip over impossible starting points
for matches. */
char *fastmap;
/* Either a translate table to apply to all characters before
comparing them, or zero for no translation. The translation is
applied to a pattern when it is compiled and to a string when it
is matched. */
RE_TRANSLATE_TYPE translate;
/* Number of subexpressions found by the compiler. */
size_t re_nsub;
/* Zero if this pattern cannot match the empty string, one else.
Well, in truth it's used only in `re_search_2', to see whether or
not we should use the fastmap, so we don't set this absolutely
perfectly; see `re_compile_fastmap' (the `duplicate' case). */
unsigned can_be_null : 1;
/* If REGS_UNALLOCATED, allocate space in the `regs' structure
for `max (RE_NREGS, re_nsub + 1)' groups.
If REGS_REALLOCATE, reallocate space if necessary.
If REGS_FIXED, use what's there. */
#define REGS_UNALLOCATED 0
#define REGS_REALLOCATE 1
#define REGS_FIXED 2
unsigned regs_allocated : 2;
/* Set to zero when `regex_compile' compiles a pattern; set to one
by `re_compile_fastmap' if it updates the fastmap. */
unsigned fastmap_accurate : 1;
/* If set, `re_match_2' does not return information about
subexpressions. */
unsigned no_sub : 1;
/* If set, a beginning-of-line anchor doesn't match at the beginning
of the string. */
unsigned not_bol : 1;
/* Similarly for an end-of-line anchor. */
unsigned not_eol : 1;
/* If true, an anchor at a newline matches. */
unsigned newline_anchor : 1;
};
typedef struct re_pattern_buffer regex_t;
/* Type for byte offsets within the string. POSIX mandates this. */
typedef int regoff_t;
/* This is the structure we store register match data in. See
regex.texinfo for a full description of what registers match. */
struct re_registers
{
unsigned num_regs;
regoff_t *start;
regoff_t *end;
};
/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
`re_match_2' returns information about at least this many registers
the first time a `regs' structure is passed. */
#ifndef RE_NREGS
# define RE_NREGS 30
#endif
/* POSIX specification for registers. Aside from the different names than
`re_registers', POSIX uses an array of structures, instead of a
structure of arrays. */
typedef struct
{
regoff_t rm_so; /* Byte offset from string's start to substring's start. */
regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
} regmatch_t;
/* Declarations for routines. */
/* Sets the current default syntax to SYNTAX, and return the old syntax.
You can also simply assign to the `re_syntax_options' variable. */
extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax);
/* Compile the regular expression PATTERN, with length LENGTH
and syntax given by the global `re_syntax_options', into the buffer
BUFFER. Return NULL if successful, and an error string if not. */
extern const char *re_compile_pattern (const char *__pattern, size_t __length,
struct re_pattern_buffer *__buffer);
/* Compile a fastmap for the compiled pattern in BUFFER; used to
accelerate searches. Return 0 if successful and -2 if was an
internal error. */
extern int re_compile_fastmap (struct re_pattern_buffer *__buffer);
/* Search in the string STRING (with length LENGTH) for the pattern
compiled into BUFFER. Start searching at position START, for RANGE
characters. Return the starting position of the match, -1 for no
match, or -2 for an internal error. Also return register
information in REGS (if REGS and BUFFER->no_sub are nonzero). */
extern int re_search (struct re_pattern_buffer *__buffer, const char *__string,
int __length, int __start, int __range,
struct re_registers *__regs);
/* Like `re_search', but search in the concatenation of STRING1 and
STRING2. Also, stop searching at index START + STOP. */
extern int re_search_2 (struct re_pattern_buffer *__buffer,
const char *__string1, int __length1,
const char *__string2, int __length2, int __start,
int __range, struct re_registers *__regs, int __stop);
/* Like `re_search', but return how many characters in STRING the regexp
in BUFFER matched, starting at position START. */
extern int re_match (struct re_pattern_buffer *__buffer, const char *__string,
int __length, int __start, struct re_registers *__regs);
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
extern int re_match_2 (struct re_pattern_buffer *__buffer,
const char *__string1, int __length1,
const char *__string2, int __length2, int __start,
struct re_registers *__regs, int __stop);
/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
ENDS. Subsequent matches using BUFFER and REGS will use this memory
for recording register information. STARTS and ENDS must be
allocated with malloc, and must each be at least `NUM_REGS * sizeof
(regoff_t)' bytes long.
If NUM_REGS == 0, then subsequent matches should allocate their own
register data.
Unless this function is called, the first search or match using
PATTERN_BUFFER will allocate its own register data, without
freeing the old data. */
extern void re_set_registers (struct re_pattern_buffer *__buffer,
struct re_registers *__regs,
unsigned int __num_regs,
regoff_t *__starts, regoff_t *__ends);
#if defined _REGEX_RE_COMP || defined _LIBC
# ifndef _CRAY
/* 4.2 bsd compatibility. */
extern char *re_comp (const char *);
extern int re_exec (const char *);
# endif
#endif
/* GCC 2.95 and later have "__restrict"; C99 compilers have
"restrict", and "configure" may have defined "restrict". */
#ifndef __restrict
# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
# if defined restrict || 199901L <= __STDC_VERSION__
# define __restrict restrict
# else
# define __restrict
# endif
# endif
#endif
/* gcc 3.1 and up support the [restrict] syntax. */
#ifndef __restrict_arr
# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) \
&& !defined __GNUG__
# define __restrict_arr __restrict
# else
# define __restrict_arr
# endif
#endif
/* POSIX compatibility. */
extern int regcomp (regex_t *__restrict __preg,
const char *__restrict __pattern,
int __cflags);
extern int regexec (const regex_t *__restrict __preg,
const char *__restrict __string, size_t __nmatch,
regmatch_t __pmatch[__restrict_arr],
int __eflags);
extern size_t regerror (int __errcode, const regex_t *__restrict __preg,
char *__restrict __errbuf, size_t __errbuf_size);
extern void regfree (regex_t *__preg);
#ifdef __cplusplus
}
#endif /* C++ */
#endif /* regex.h */
sra_sdk-2.1.7/interfaces/ext/zconf.h 0000644 0012213 0011620 00000017507 11476747550 017100 0 ustar rodarmer trace /* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2010 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#ifndef ZCONF_H
#define ZCONF_H
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# include
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#if UNIX
# define Z_HAVE_UNISTD_H
#endif
#ifdef STDC
# include /* for off_t */
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
* though the former does not conform to the LFS document), but considering
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
#if -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif
#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
# include /* for SEEK_* and off_t */
# ifdef VMS
# include /* for off_t */
# endif
# ifndef z_off_t
# define z_off_t off_t
# endif
#endif
#ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
# define z_off64_t off64_t
#else
# define z_off64_t z_off_t
#endif
#if defined(__OS400__)
# define NO_vsnprintf
#endif
#if defined(__MVS__)
# define NO_vsnprintf
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
#pragma map(deflateInit_,"DEIN")
#pragma map(deflateInit2_,"DEIN2")
#pragma map(deflateEnd,"DEEND")
#pragma map(deflateBound,"DEBND")
#pragma map(inflateInit_,"ININ")
#pragma map(inflateInit2_,"ININ2")
#pragma map(inflateEnd,"INEND")
#pragma map(inflateSync,"INSY")
#pragma map(inflateSetDictionary,"INSEDI")
#pragma map(compressBound,"CMBND")
#pragma map(inflate_table,"INTABL")
#pragma map(inflate_fast,"INFA")
#pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */
sra_sdk-2.1.7/interfaces/ext/zlib.h 0000644 0012213 0011620 00000233314 11476747550 016715 0 ustar rodarmer trace /* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.2.5, April 19th, 2010
Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
The data format used by the zlib library is described by RFCs (Request for
Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
*/
#ifndef ZLIB_H
#define ZLIB_H
#include "zconf.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ZLIB_VERSION "1.2.5"
#define ZLIB_VERNUM 0x1250
#define ZLIB_VER_MAJOR 1
#define ZLIB_VER_MINOR 2
#define ZLIB_VER_REVISION 5
#define ZLIB_VER_SUBREVISION 0
/*
The 'zlib' compression library provides in-memory compression and
decompression functions, including integrity checks of the uncompressed data.
This version of the library supports only one compression method (deflation)
but other algorithms will be added later and will have the same stream
interface.
Compression can be done in a single step if the buffers are large enough,
or can be done by repeated calls of the compression function. In the latter
case, the application must provide more input and/or consume the output
(providing more output space) before each call.
The compressed data format used by default by the in-memory functions is
the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
around a deflate stream, which is itself documented in RFC 1951.
The library also supports reading and writing files in gzip (.gz) format
with an interface similar to that of stdio using the functions that start
with "gz". The gzip format is different from the zlib format. gzip is a
gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
This library can optionally read and write gzip streams in memory as well.
The zlib format was designed to be compact and fast for use in memory
and on communications channels. The gzip format was designed for single-
file compression on file systems, has a larger header than zlib to maintain
directory information, and uses a different, slower check method than zlib.
The library does not install any signal handler. The decoder checks
the consistency of the compressed data, so the library should never crash
even in case of corrupted input.
*/
typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
typedef void (*free_func) OF((voidpf opaque, voidpf address));
struct internal_state;
typedef struct z_stream_s {
Bytef *next_in; /* next input byte */
uInt avail_in; /* number of bytes available at next_in */
uLong total_in; /* total nb of input bytes read so far */
Bytef *next_out; /* next output byte should be put there */
uInt avail_out; /* remaining free space at next_out */
uLong total_out; /* total nb of bytes output so far */
char *msg; /* last error message, NULL if no error */
struct internal_state FAR *state; /* not visible by applications */
alloc_func zalloc; /* used to allocate the internal state */
free_func zfree; /* used to free the internal state */
voidpf opaque; /* private data object passed to zalloc and zfree */
int data_type; /* best guess about the data type: binary or text */
uLong adler; /* adler32 value of the uncompressed data */
uLong reserved; /* reserved for future use */
} z_stream;
typedef z_stream FAR *z_streamp;
/*
gzip header information passed to and from zlib routines. See RFC 1952
for more details on the meanings of these fields.
*/
typedef struct gz_header_s {
int text; /* true if compressed data believed to be text */
uLong time; /* modification time */
int xflags; /* extra flags (not used when writing a gzip file) */
int os; /* operating system */
Bytef *extra; /* pointer to extra field or Z_NULL if none */
uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
uInt extra_max; /* space at extra (only when reading header) */
Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
uInt name_max; /* space at name (only when reading header) */
Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
uInt comm_max; /* space at comment (only when reading header) */
int hcrc; /* true if there was or will be a header crc */
int done; /* true when done reading gzip header (not used
when writing a gzip file) */
} gz_header;
typedef gz_header FAR *gz_headerp;
/*
The application must update next_in and avail_in when avail_in has dropped
to zero. It must update next_out and avail_out when avail_out has dropped
to zero. The application must initialize zalloc, zfree and opaque before
calling the init function. All other fields are set by the compression
library and must not be updated by the application.
The opaque value provided by the application will be passed as the first
parameter for calls of zalloc and zfree. This can be useful for custom
memory management. The compression library attaches no meaning to the
opaque value.
zalloc must return Z_NULL if there is not enough memory for the object.
If zlib is used in a multi-threaded application, zalloc and zfree must be
thread safe.
On 16-bit systems, the functions zalloc and zfree must be able to allocate
exactly 65536 bytes, but will not be required to allocate more than this if
the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers
returned by zalloc for objects of exactly 65536 bytes *must* have their
offset normalized to zero. The default allocation function provided by this
library ensures this (see zutil.c). To reduce memory requirements and avoid
any allocation of 64K objects, at the expense of compression ratio, compile
the library with -DMAX_WBITS=14 (see zconf.h).
The fields total_in and total_out can be used for statistics or progress
reports. After compression, total_in holds the total size of the
uncompressed data and may be saved for use in the decompressor (particularly
if the decompressor wants to decompress everything in a single step).
*/
/* constants */
#define Z_NO_FLUSH 0
#define Z_PARTIAL_FLUSH 1
#define Z_SYNC_FLUSH 2
#define Z_FULL_FLUSH 3
#define Z_FINISH 4
#define Z_BLOCK 5
#define Z_TREES 6
/* Allowed flush values; see deflate() and inflate() below for details */
#define Z_OK 0
#define Z_STREAM_END 1
#define Z_NEED_DICT 2
#define Z_ERRNO (-1)
#define Z_STREAM_ERROR (-2)
#define Z_DATA_ERROR (-3)
#define Z_MEM_ERROR (-4)
#define Z_BUF_ERROR (-5)
#define Z_VERSION_ERROR (-6)
/* Return codes for the compression/decompression functions. Negative values
* are errors, positive values are used for special but normal events.
*/
#define Z_NO_COMPRESSION 0
#define Z_BEST_SPEED 1
#define Z_BEST_COMPRESSION 9
#define Z_DEFAULT_COMPRESSION (-1)
/* compression levels */
#define Z_FILTERED 1
#define Z_HUFFMAN_ONLY 2
#define Z_RLE 3
#define Z_FIXED 4
#define Z_DEFAULT_STRATEGY 0
/* compression strategy; see deflateInit2() below for details */
#define Z_BINARY 0
#define Z_TEXT 1
#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */
#define Z_UNKNOWN 2
/* Possible values of the data_type field (though see inflate()) */
#define Z_DEFLATED 8
/* The deflate compression method (the only one supported in this version) */
#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
#define zlib_version zlibVersion()
/* for compatibility with versions < 1.0.2 */
/* basic functions */
ZEXTERN const char * ZEXPORT zlibVersion OF((void));
/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
If the first character differs, the library code actually used is not
compatible with the zlib.h header file used by the application. This check
is automatically made by deflateInit and inflateInit.
*/
/*
ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
Initializes the internal stream state for compression. The fields
zalloc, zfree and opaque must be initialized before by the caller. If
zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
allocation functions.
The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
1 gives best speed, 9 gives best compression, 0 gives no compression at all
(the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION
requests a default compromise between speed and compression (currently
equivalent to level 6).
deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_STREAM_ERROR if level is not a valid compression level, or
Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
with the version assumed by the caller (ZLIB_VERSION). msg is set to null
if there is no error message. deflateInit does not perform any compression:
this will be done by deflate().
*/
ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
/*
deflate compresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may introduce
some output latency (reading input without producing any output) except when
forced to flush.
The detailed semantics are as follows. deflate performs one or both of the
following actions:
- Compress more input starting at next_in and update next_in and avail_in
accordingly. If not all input can be processed (because there is not
enough room in the output buffer), next_in and avail_in are updated and
processing will resume at this point for the next call of deflate().
- Provide more output starting at next_out and update next_out and avail_out
accordingly. This action is forced if the parameter flush is non zero.
Forcing flush frequently degrades the compression ratio, so this parameter
should be set only when necessary (in interactive applications). Some
output may be provided even if flush is not set.
Before the call of deflate(), the application should ensure that at least
one of the actions is possible, by providing more input and/or consuming more
output, and updating avail_in or avail_out accordingly; avail_out should
never be zero before the call. The application can consume the compressed
output when it wants, for example when the output buffer is full (avail_out
== 0), or after each call of deflate(). If deflate returns Z_OK and with
zero avail_out, it must be called again after making room in the output
buffer because there might be more output pending.
Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
decide how much data to accumulate before producing output, in order to
maximize compression.
If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
flushed to the output buffer and the output is aligned on a byte boundary, so
that the decompressor can get all input data available so far. (In
particular avail_in is zero after the call if enough output space has been
provided before the call.) Flushing may degrade compression for some
compression algorithms and so it should be used only when necessary. This
completes the current deflate block and follows it with an empty stored block
that is three bits plus filler bits to the next byte, followed by four bytes
(00 00 ff ff).
If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the
output buffer, but the output is not aligned to a byte boundary. All of the
input data so far will be available to the decompressor, as for Z_SYNC_FLUSH.
This completes the current deflate block and follows it with an empty fixed
codes block that is 10 bits long. This assures that enough bytes are output
in order for the decompressor to finish the block before the empty fixed code
block.
If flush is set to Z_BLOCK, a deflate block is completed and emitted, as
for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to
seven bits of the current block are held to be written as the next byte after
the next deflate block is completed. In this case, the decompressor may not
be provided enough bits at this point in order to complete decompression of
the data provided so far to the compressor. It may need to wait for the next
block to be emitted. This is for advanced applications that need to control
the emission of deflate blocks.
If flush is set to Z_FULL_FLUSH, all output is flushed as with
Z_SYNC_FLUSH, and the compression state is reset so that decompression can
restart from this point if previous compressed data has been damaged or if
random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
compression.
If deflate returns with avail_out == 0, this function must be called again
with the same value of the flush parameter and more output space (updated
avail_out), until the flush is complete (deflate returns with non-zero
avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
avail_out is greater than six to avoid repeated flush markers due to
avail_out == 0 on return.
If the parameter flush is set to Z_FINISH, pending input is processed,
pending output is flushed and deflate returns with Z_STREAM_END if there was
enough output space; if deflate returns with Z_OK, this function must be
called again with Z_FINISH and more output space (updated avail_out) but no
more input data, until it returns with Z_STREAM_END or an error. After
deflate has returned Z_STREAM_END, the only possible operations on the stream
are deflateReset or deflateEnd.
Z_FINISH can be used immediately after deflateInit if all the compression
is to be done in a single step. In this case, avail_out must be at least the
value returned by deflateBound (see below). If deflate does not return
Z_STREAM_END, then it must be called again as described above.
deflate() sets strm->adler to the adler32 checksum of all input read
so far (that is, total_in bytes).
deflate() may update strm->data_type if it can make a good guess about
the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
binary. This field is only for information purposes and does not affect the
compression algorithm in any manner.
deflate() returns Z_OK if some progress has been made (more input
processed or more output produced), Z_STREAM_END if all input has been
consumed and all output has been produced (only when flush is set to
Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible
(for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
fatal, and deflate() can be called again with more input and more output
space to continue compressing.
*/
ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
/*
All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any pending
output.
deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
stream state was inconsistent, Z_DATA_ERROR if the stream was freed
prematurely (some input or output was discarded). In the error case, msg
may be set but then points to a static string (which must not be
deallocated).
*/
/*
ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
Initializes the internal stream state for decompression. The fields
next_in, avail_in, zalloc, zfree and opaque must be initialized before by
the caller. If next_in is not Z_NULL and avail_in is large enough (the
exact value depends on the compression method), inflateInit determines the
compression method from the zlib header and allocates all data structures
accordingly; otherwise the allocation will be deferred to the first call of
inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
use default allocation functions.
inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
version assumed by the caller, or Z_STREAM_ERROR if the parameters are
invalid, such as a null pointer to the structure. msg is set to null if
there is no error message. inflateInit does not perform any decompression
apart from possibly reading the zlib header if present: actual decompression
will be done by inflate(). (So next_in and avail_in may be modified, but
next_out and avail_out are unused and unchanged.) The current implementation
of inflateInit() does not process any header information -- that is deferred
until inflate() is called.
*/
ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
/*
inflate decompresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may introduce
some output latency (reading input without producing any output) except when
forced to flush.
The detailed semantics are as follows. inflate performs one or both of the
following actions:
- Decompress more input starting at next_in and update next_in and avail_in
accordingly. If not all input can be processed (because there is not
enough room in the output buffer), next_in is updated and processing will
resume at this point for the next call of inflate().
- Provide more output starting at next_out and update next_out and avail_out
accordingly. inflate() provides as much output as possible, until there is
no more input data or no more space in the output buffer (see below about
the flush parameter).
Before the call of inflate(), the application should ensure that at least
one of the actions is possible, by providing more input and/or consuming more
output, and updating the next_* and avail_* values accordingly. The
application can consume the uncompressed output when it wants, for example
when the output buffer is full (avail_out == 0), or after each call of
inflate(). If inflate returns Z_OK and with zero avail_out, it must be
called again after making room in the output buffer because there might be
more output pending.
The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH,
Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much
output as possible to the output buffer. Z_BLOCK requests that inflate()
stop if and when it gets to the next deflate block boundary. When decoding
the zlib or gzip format, this will cause inflate() to return immediately
after the header and before the first block. When doing a raw inflate,
inflate() will go ahead and process the first block, and will return when it
gets to the end of that block, or when it runs out of data.
The Z_BLOCK option assists in appending to or combining deflate streams.
Also to assist in this, on return inflate() will set strm->data_type to the
number of unused bits in the last byte taken from strm->next_in, plus 64 if
inflate() is currently decoding the last block in the deflate stream, plus
128 if inflate() returned immediately after decoding an end-of-block code or
decoding the complete header up to just before the first byte of the deflate
stream. The end-of-block will not be indicated until all of the uncompressed
data from that block has been written to strm->next_out. The number of
unused bits may in general be greater than seven, except when bit 7 of
data_type is set, in which case the number of unused bits will be less than
eight. data_type is set as noted here every time inflate() returns for all
flush options, and so can be used to determine the amount of currently
consumed input in bits.
The Z_TREES option behaves as Z_BLOCK does, but it also returns when the
end of each deflate block header is reached, before any actual data in that
block is decoded. This allows the caller to determine the length of the
deflate block header for later use in random access within a deflate block.
256 is added to the value of strm->data_type when inflate() returns
immediately after reaching the end of the deflate block header.
inflate() should normally be called until it returns Z_STREAM_END or an
error. However if all decompression is to be performed in a single step (a
single call of inflate), the parameter flush should be set to Z_FINISH. In
this case all pending input is processed and all pending output is flushed;
avail_out must be large enough to hold all the uncompressed data. (The size
of the uncompressed data may have been saved by the compressor for this
purpose.) The next operation on this stream must be inflateEnd to deallocate
the decompression state. The use of Z_FINISH is never required, but can be
used to inform inflate that a faster approach may be used for the single
inflate() call.
In this implementation, inflate() always flushes as much output as
possible to the output buffer, and always uses the faster approach on the
first call. So the only effect of the flush parameter in this implementation
is on the return value of inflate(), as noted below, or when it returns early
because Z_BLOCK or Z_TREES is used.
If a preset dictionary is needed after this call (see inflateSetDictionary
below), inflate sets strm->adler to the adler32 checksum of the dictionary
chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
strm->adler to the adler32 checksum of all output produced so far (that is,
total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
below. At the end of the stream, inflate() checks that its computed adler32
checksum is equal to that saved by the compressor and returns Z_STREAM_END
only if the checksum is correct.
inflate() can decompress and check either zlib-wrapped or gzip-wrapped
deflate data. The header type is detected automatically, if requested when
initializing with inflateInit2(). Any information contained in the gzip
header is not retained, so applications that need that information should
instead use raw inflate, see inflateInit2() below, or inflateBack() and
perform their own processing of the gzip header and trailer.
inflate() returns Z_OK if some progress has been made (more input processed
or more output produced), Z_STREAM_END if the end of the compressed data has
been reached and all uncompressed output has been produced, Z_NEED_DICT if a
preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
corrupted (input stream not conforming to the zlib format or incorrect check
value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory,
Z_BUF_ERROR if no progress is possible or if there was not enough room in the
output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
inflate() can be called again with more input and more output space to
continue decompressing. If Z_DATA_ERROR is returned, the application may
then call inflateSync() to look for a good compression block if a partial
recovery of the data is desired.
*/
ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
/*
All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any pending
output.
inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
was inconsistent. In the error case, msg may be set but then points to a
static string (which must not be deallocated).
*/
/* Advanced functions */
/*
The following functions are needed only in some special applications.
*/
/*
ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
int level,
int method,
int windowBits,
int memLevel,
int strategy));
This is another version of deflateInit with more compression options. The
fields next_in, zalloc, zfree and opaque must be initialized before by the
caller.
The method parameter is the compression method. It must be Z_DEFLATED in
this version of the library.
The windowBits parameter is the base two logarithm of the window size
(the size of the history buffer). It should be in the range 8..15 for this
version of the library. Larger values of this parameter result in better
compression at the expense of memory usage. The default value is 15 if
deflateInit is used instead.
windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
determines the window size. deflate() will then generate raw deflate data
with no zlib header or trailer, and will not compute an adler32 check value.
windowBits can also be greater than 15 for optional gzip encoding. Add
16 to windowBits to write a simple gzip header and trailer around the
compressed data instead of a zlib wrapper. The gzip header will have no
file name, no extra data, no comment, no modification time (set to zero), no
header crc, and the operating system will be set to 255 (unknown). If a
gzip stream is being written, strm->adler is a crc32 instead of an adler32.
The memLevel parameter specifies how much memory should be allocated
for the internal compression state. memLevel=1 uses minimum memory but is
slow and reduces compression ratio; memLevel=9 uses maximum memory for
optimal speed. The default value is 8. See zconf.h for total memory usage
as a function of windowBits and memLevel.
The strategy parameter is used to tune the compression algorithm. Use the
value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
string match), or Z_RLE to limit match distances to one (run-length
encoding). Filtered data consists mostly of small values with a somewhat
random distribution. In this case, the compression algorithm is tuned to
compress them better. The effect of Z_FILTERED is to force more Huffman
coding and less string matching; it is somewhat intermediate between
Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as
fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The
strategy parameter only affects the compression ratio but not the
correctness of the compressed output even if it is not set appropriately.
Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler
decoder for special applications.
deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid
method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is
incompatible with the version assumed by the caller (ZLIB_VERSION). msg is
set to null if there is no error message. deflateInit2 does not perform any
compression: this will be done by deflate().
*/
ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
const Bytef *dictionary,
uInt dictLength));
/*
Initializes the compression dictionary from the given byte sequence
without producing any compressed output. This function must be called
immediately after deflateInit, deflateInit2 or deflateReset, before any call
of deflate. The compressor and decompressor must use exactly the same
dictionary (see inflateSetDictionary).
The dictionary should consist of strings (byte sequences) that are likely
to be encountered later in the data to be compressed, with the most commonly
used strings preferably put towards the end of the dictionary. Using a
dictionary is most useful when the data to be compressed is short and can be
predicted with good accuracy; the data can then be compressed better than
with the default empty dictionary.
Depending on the size of the compression data structures selected by
deflateInit or deflateInit2, a part of the dictionary may in effect be
discarded, for example if the dictionary is larger than the window size
provided in deflateInit or deflateInit2. Thus the strings most likely to be
useful should be put at the end of the dictionary, not at the front. In
addition, the current implementation of deflate will use at most the window
size minus 262 bytes of the provided dictionary.
Upon return of this function, strm->adler is set to the adler32 value
of the dictionary; the decompressor may later use this value to determine
which dictionary has been used by the compressor. (The adler32 value
applies to the whole dictionary even if only a subset of the dictionary is
actually used by the compressor.) If a raw deflate was requested, then the
adler32 value is not computed and strm->adler is not set.
deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
inconsistent (for example if deflate has already been called for this stream
or if the compression method is bsort). deflateSetDictionary does not
perform any compression: this will be done by deflate().
*/
ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
z_streamp source));
/*
Sets the destination stream as a complete copy of the source stream.
This function can be useful when several compression strategies will be
tried, for example when there are several ways of pre-processing the input
data with a filter. The streams that will be discarded should then be freed
by calling deflateEnd. Note that deflateCopy duplicates the internal
compression state which can be quite large, so this strategy is slow and can
consume lots of memory.
deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
(such as zalloc being Z_NULL). msg is left unchanged in both source and
destination.
*/
ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
/*
This function is equivalent to deflateEnd followed by deflateInit,
but does not free and reallocate all the internal compression state. The
stream will keep the same compression level and any other attributes that
may have been set by deflateInit2.
deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent (such as zalloc or state being Z_NULL).
*/
ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
int level,
int strategy));
/*
Dynamically update the compression level and compression strategy. The
interpretation of level and strategy is as in deflateInit2. This can be
used to switch between compression and straight copy of the input data, or
to switch to a different kind of input data requiring a different strategy.
If the compression level is changed, the input available so far is
compressed with the old level (and may be flushed); the new level will take
effect only at the next call of deflate().
Before the call of deflateParams, the stream state must be set as for
a call of deflate(), since the currently available input may have to be
compressed and flushed. In particular, strm->avail_out must be non-zero.
deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if
strm->avail_out was zero.
*/
ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
int good_length,
int max_lazy,
int nice_length,
int max_chain));
/*
Fine tune deflate's internal compression parameters. This should only be
used by someone who understands the algorithm used by zlib's deflate for
searching for the best matching string, and even then only by the most
fanatic optimizer trying to squeeze out the last compressed bit for their
specific input data. Read the deflate.c source code for the meaning of the
max_lazy, good_length, nice_length, and max_chain parameters.
deflateTune() can be called after deflateInit() or deflateInit2(), and
returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
*/
ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
uLong sourceLen));
/*
deflateBound() returns an upper bound on the compressed size after
deflation of sourceLen bytes. It must be called after deflateInit() or
deflateInit2(), and after deflateSetHeader(), if used. This would be used
to allocate an output buffer for deflation in a single pass, and so would be
called before deflate().
*/
ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
int bits,
int value));
/*
deflatePrime() inserts bits in the deflate output stream. The intent
is that this function is used to start off the deflate output with the bits
leftover from a previous deflate stream when appending to it. As such, this
function can only be used for raw deflate, and must be used before the first
deflate() call after a deflateInit2() or deflateReset(). bits must be less
than or equal to 16, and that many of the least significant bits of value
will be inserted in the output.
deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent.
*/
ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
gz_headerp head));
/*
deflateSetHeader() provides gzip header information for when a gzip
stream is requested by deflateInit2(). deflateSetHeader() may be called
after deflateInit2() or deflateReset() and before the first call of
deflate(). The text, time, os, extra field, name, and comment information
in the provided gz_header structure are written to the gzip header (xflag is
ignored -- the extra flags are set according to the compression level). The
caller must assure that, if not Z_NULL, name and comment are terminated with
a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
available there. If hcrc is true, a gzip header crc is included. Note that
the current versions of the command-line version of gzip (up through version
1.3.x) do not support header crc's, and will report that it is a "multi-part
gzip file" and give up.
If deflateSetHeader is not used, the default gzip header has text false,
the time set to zero, and os set to 255, with no extra, name, or comment
fields. The gzip header is returned to the default state by deflateReset().
deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent.
*/
/*
ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
int windowBits));
This is another version of inflateInit with an extra parameter. The
fields next_in, avail_in, zalloc, zfree and opaque must be initialized
before by the caller.
The windowBits parameter is the base two logarithm of the maximum window
size (the size of the history buffer). It should be in the range 8..15 for
this version of the library. The default value is 15 if inflateInit is used
instead. windowBits must be greater than or equal to the windowBits value
provided to deflateInit2() while compressing, or it must be equal to 15 if
deflateInit2() was not used. If a compressed stream with a larger window
size is given as input, inflate() will return with the error code
Z_DATA_ERROR instead of trying to allocate a larger window.
windowBits can also be zero to request that inflate use the window size in
the zlib header of the compressed stream.
windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
determines the window size. inflate() will then process raw deflate data,
not looking for a zlib or gzip header, not generating a check value, and not
looking for any check values for comparison at the end of the stream. This
is for use with other formats that use the deflate compressed data format
such as zip. Those formats provide their own check values. If a custom
format is developed using the raw deflate format for compressed data, it is
recommended that a check value such as an adler32 or a crc32 be applied to
the uncompressed data as is done in the zlib, gzip, and zip formats. For
most applications, the zlib format should be used as is. Note that comments
above on the use in deflateInit2() applies to the magnitude of windowBits.
windowBits can also be greater than 15 for optional gzip decoding. Add
32 to windowBits to enable zlib and gzip decoding with automatic header
detection, or add 16 to decode only the gzip format (the zlib format will
return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a
crc32 instead of an adler32.
inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
version assumed by the caller, or Z_STREAM_ERROR if the parameters are
invalid, such as a null pointer to the structure. msg is set to null if
there is no error message. inflateInit2 does not perform any decompression
apart from possibly reading the zlib header if present: actual decompression
will be done by inflate(). (So next_in and avail_in may be modified, but
next_out and avail_out are unused and unchanged.) The current implementation
of inflateInit2() does not process any header information -- that is
deferred until inflate() is called.
*/
ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
const Bytef *dictionary,
uInt dictLength));
/*
Initializes the decompression dictionary from the given uncompressed byte
sequence. This function must be called immediately after a call of inflate,
if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
can be determined from the adler32 value returned by that call of inflate.
The compressor and decompressor must use exactly the same dictionary (see
deflateSetDictionary). For raw inflate, this function can be called
immediately after inflateInit2() or inflateReset() and before any call of
inflate() to set the dictionary. The application must insure that the
dictionary that was used for compression is provided.
inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
expected one (incorrect adler32 value). inflateSetDictionary does not
perform any decompression: this will be done by subsequent calls of
inflate().
*/
ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
/*
Skips invalid compressed data until a full flush point (see above the
description of deflate with Z_FULL_FLUSH) can be found, or until all
available input is skipped. No output is provided.
inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
if no more input was provided, Z_DATA_ERROR if no flush point has been
found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the
success case, the application may save the current current value of total_in
which indicates where valid compressed data was found. In the error case,
the application may repeatedly call inflateSync, providing more input each
time, until success or end of the input data.
*/
ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
z_streamp source));
/*
Sets the destination stream as a complete copy of the source stream.
This function can be useful when randomly accessing a large stream. The
first pass through the stream can periodically record the inflate state,
allowing restarting inflate at those points when randomly accessing the
stream.
inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
(such as zalloc being Z_NULL). msg is left unchanged in both source and
destination.
*/
ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
/*
This function is equivalent to inflateEnd followed by inflateInit,
but does not free and reallocate all the internal decompression state. The
stream will keep attributes that may have been set by inflateInit2.
inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent (such as zalloc or state being Z_NULL).
*/
ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
int windowBits));
/*
This function is the same as inflateReset, but it also permits changing
the wrap and window size requests. The windowBits parameter is interpreted
the same as it is for inflateInit2.
inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent (such as zalloc or state being Z_NULL), or if
the windowBits parameter is invalid.
*/
ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
int bits,
int value));
/*
This function inserts bits in the inflate input stream. The intent is
that this function is used to start inflating at a bit position in the
middle of a byte. The provided bits will be used before any bytes are used
from next_in. This function should only be used with raw inflate, and
should be used before the first inflate() call after inflateInit2() or
inflateReset(). bits must be less than or equal to 16, and that many of the
least significant bits of value will be inserted in the input.
If bits is negative, then the input stream bit buffer is emptied. Then
inflatePrime() can be called again to put bits in the buffer. This is used
to clear out bits leftover after feeding inflate a block description prior
to feeding inflate codes.
inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent.
*/
ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
/*
This function returns two values, one in the lower 16 bits of the return
value, and the other in the remaining upper bits, obtained by shifting the
return value down 16 bits. If the upper value is -1 and the lower value is
zero, then inflate() is currently decoding information outside of a block.
If the upper value is -1 and the lower value is non-zero, then inflate is in
the middle of a stored block, with the lower value equaling the number of
bytes from the input remaining to copy. If the upper value is not -1, then
it is the number of bits back from the current bit position in the input of
the code (literal or length/distance pair) currently being processed. In
that case the lower value is the number of bytes already emitted for that
code.
A code is being processed if inflate is waiting for more input to complete
decoding of the code, or if it has completed decoding but is waiting for
more output space to write the literal or match data.
inflateMark() is used to mark locations in the input data for random
access, which may be at bit positions, and to note those cases where the
output of a code may span boundaries of random access blocks. The current
location in the input stream can be determined from avail_in and data_type
as noted in the description for the Z_BLOCK flush parameter for inflate.
inflateMark returns the value noted above or -1 << 16 if the provided
source stream state was inconsistent.
*/
ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
gz_headerp head));
/*
inflateGetHeader() requests that gzip header information be stored in the
provided gz_header structure. inflateGetHeader() may be called after
inflateInit2() or inflateReset(), and before the first call of inflate().
As inflate() processes the gzip stream, head->done is zero until the header
is completed, at which time head->done is set to one. If a zlib stream is
being decoded, then head->done is set to -1 to indicate that there will be
no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be
used to force inflate() to return immediately after header processing is
complete and before any actual data is decompressed.
The text, time, xflags, and os fields are filled in with the gzip header
contents. hcrc is set to true if there is a header CRC. (The header CRC
was valid if done is set to one.) If extra is not Z_NULL, then extra_max
contains the maximum number of bytes to write to extra. Once done is true,
extra_len contains the actual extra field length, and extra contains the
extra field, or that field truncated if extra_max is less than extra_len.
If name is not Z_NULL, then up to name_max characters are written there,
terminated with a zero unless the length is greater than name_max. If
comment is not Z_NULL, then up to comm_max characters are written there,
terminated with a zero unless the length is greater than comm_max. When any
of extra, name, or comment are not Z_NULL and the respective field is not
present in the header, then that field is set to Z_NULL to signal its
absence. This allows the use of deflateSetHeader() with the returned
structure to duplicate the header. However if those fields are set to
allocated memory, then the application will need to save those pointers
elsewhere so that they can be eventually freed.
If inflateGetHeader is not used, then the header information is simply
discarded. The header is always checked for validity, including the header
CRC if present. inflateReset() will reset the process to discard the header
information. The application would need to call inflateGetHeader() again to
retrieve the header from the next gzip stream.
inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent.
*/
/*
ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
unsigned char FAR *window));
Initialize the internal stream state for decompression using inflateBack()
calls. The fields zalloc, zfree and opaque in strm must be initialized
before the call. If zalloc and zfree are Z_NULL, then the default library-
derived memory allocation routines are used. windowBits is the base two
logarithm of the window size, in the range 8..15. window is a caller
supplied buffer of that size. Except for special applications where it is
assured that deflate was used with small window sizes, windowBits must be 15
and a 32K byte window must be supplied to be able to decompress general
deflate streams.
See inflateBack() for the usage of these routines.
inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
the paramaters are invalid, Z_MEM_ERROR if the internal state could not be
allocated, or Z_VERSION_ERROR if the version of the library does not match
the version of the header file.
*/
typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
in_func in, void FAR *in_desc,
out_func out, void FAR *out_desc));
/*
inflateBack() does a raw inflate with a single call using a call-back
interface for input and output. This is more efficient than inflate() for
file i/o applications in that it avoids copying between the output and the
sliding window by simply making the window itself the output buffer. This
function trusts the application to not change the output buffer passed by
the output function, at least until inflateBack() returns.
inflateBackInit() must be called first to allocate the internal state
and to initialize the state with the user-provided window buffer.
inflateBack() may then be used multiple times to inflate a complete, raw
deflate stream with each call. inflateBackEnd() is then called to free the
allocated state.
A raw deflate stream is one with no zlib or gzip header or trailer.
This routine would normally be used in a utility that reads zip or gzip
files and writes out uncompressed files. The utility would decode the
header and process the trailer on its own, hence this routine expects only
the raw deflate stream to decompress. This is different from the normal
behavior of inflate(), which expects either a zlib or gzip header and
trailer around the deflate stream.
inflateBack() uses two subroutines supplied by the caller that are then
called by inflateBack() for input and output. inflateBack() calls those
routines until it reads a complete deflate stream and writes out all of the
uncompressed data, or until it encounters an error. The function's
parameters and return types are defined above in the in_func and out_func
typedefs. inflateBack() will call in(in_desc, &buf) which should return the
number of bytes of provided input, and a pointer to that input in buf. If
there is no input available, in() must return zero--buf is ignored in that
case--and inflateBack() will return a buffer error. inflateBack() will call
out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out()
should return zero on success, or non-zero on failure. If out() returns
non-zero, inflateBack() will return with an error. Neither in() nor out()
are permitted to change the contents of the window provided to
inflateBackInit(), which is also the buffer that out() uses to write from.
The length written by out() will be at most the window size. Any non-zero
amount of input may be provided by in().
For convenience, inflateBack() can be provided input on the first call by
setting strm->next_in and strm->avail_in. If that input is exhausted, then
in() will be called. Therefore strm->next_in must be initialized before
calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called
immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in
must also be initialized, and then if strm->avail_in is not zero, input will
initially be taken from strm->next_in[0 .. strm->avail_in - 1].
The in_desc and out_desc parameters of inflateBack() is passed as the
first parameter of in() and out() respectively when they are called. These
descriptors can be optionally used to pass any information that the caller-
supplied in() and out() functions need to do their job.
On return, inflateBack() will set strm->next_in and strm->avail_in to
pass back any unused input that was provided by the last in() call. The
return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
if in() or out() returned an error, Z_DATA_ERROR if there was a format error
in the deflate stream (in which case strm->msg is set to indicate the nature
of the error), or Z_STREAM_ERROR if the stream was not properly initialized.
In the case of Z_BUF_ERROR, an input or output error can be distinguished
using strm->next_in which will be Z_NULL only if in() returned an error. If
strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
non-zero. (in() will always be called before out(), so strm->next_in is
assured to be defined if out() returns non-zero.) Note that inflateBack()
cannot return Z_OK.
*/
ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
/*
All memory allocated by inflateBackInit() is freed.
inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
state was inconsistent.
*/
ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
/* Return flags indicating compile-time options.
Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
1.0: size of uInt
3.2: size of uLong
5.4: size of voidpf (pointer)
7.6: size of z_off_t
Compiler, assembler, and debug options:
8: DEBUG
9: ASMV or ASMINF -- use ASM code
10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
11: 0 (reserved)
One-time table building (smaller code, but not thread-safe if true):
12: BUILDFIXED -- build static block decoding tables when needed
13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
14,15: 0 (reserved)
Library content (indicates missing functionality):
16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
deflate code when not needed)
17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
and decode gzip streams (to avoid linking crc code)
18-19: 0 (reserved)
Operation variations (changes in library functionality):
20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
21: FASTEST -- deflate algorithm with only one, lowest compression level
22,23: 0 (reserved)
The sprintf variant used by gzprintf (zero is best):
24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
26: 0 = returns value, 1 = void -- 1 means inferred string length returned
Remainder:
27-31: 0 (reserved)
*/
/* utility functions */
/*
The following utility functions are implemented on top of the basic
stream-oriented functions. To simplify the interface, some default options
are assumed (compression level and memory usage, standard memory allocation
functions). The source code of these utility functions can be modified if
you need special options.
*/
ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen));
/*
Compresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total size
of the destination buffer, which must be at least the value returned by
compressBound(sourceLen). Upon exit, destLen is the actual size of the
compressed buffer.
compress returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_BUF_ERROR if there was not enough room in the output
buffer.
*/
ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen,
int level));
/*
Compresses the source buffer into the destination buffer. The level
parameter has the same meaning as in deflateInit. sourceLen is the byte
length of the source buffer. Upon entry, destLen is the total size of the
destination buffer, which must be at least the value returned by
compressBound(sourceLen). Upon exit, destLen is the actual size of the
compressed buffer.
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid.
*/
ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
/*
compressBound() returns an upper bound on the compressed size after
compress() or compress2() on sourceLen bytes. It would be used before a
compress() or compress2() call to allocate the destination buffer.
*/
ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen));
/*
Decompresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total size
of the destination buffer, which must be large enough to hold the entire
uncompressed data. (The size of the uncompressed data must have been saved
previously by the compressor and transmitted to the decompressor by some
mechanism outside the scope of this compression library.) Upon exit, destLen
is the actual size of the uncompressed buffer.
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_BUF_ERROR if there was not enough room in the output
buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
*/
/* gzip file access functions */
/*
This library supports reading and writing files in gzip (.gz) format with
an interface similar to that of stdio, using the functions that start with
"gz". The gzip format is different from the zlib format. gzip is a gzip
wrapper, documented in RFC 1952, wrapped around a deflate stream.
*/
typedef voidp gzFile; /* opaque gzip file descriptor */
/*
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
Opens a gzip (.gz) file for reading or writing. The mode parameter is as
in fopen ("rb" or "wb") but can also include a compression level ("wb9") or
a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'
for fixed code compression as in "wb9F". (See the description of
deflateInit2 for more information about the strategy parameter.) Also "a"
can be used instead of "w" to request that the gzip stream that will be
written be appended to the file. "+" will result in an error, since reading
and writing to the same gzip file is not supported.
gzopen can be used to read a file which is not in gzip format; in this
case gzread will directly read from the file without decompression.
gzopen returns NULL if the file could not be opened, if there was
insufficient memory to allocate the gzFile state, or if an invalid mode was
specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
errno can be checked to determine if the reason gzopen failed was that the
file could not be opened.
*/
ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
/*
gzdopen associates a gzFile with the file descriptor fd. File descriptors
are obtained from calls like open, dup, creat, pipe or fileno (if the file
has been previously opened with fopen). The mode parameter is as in gzopen.
The next call of gzclose on the returned gzFile will also close the file
descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,
mode);. The duplicated descriptor should be saved to avoid a leak, since
gzdopen does not close fd if it fails.
gzdopen returns NULL if there was insufficient memory to allocate the
gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not
provided, or '+' was provided), or if fd is -1. The file descriptor is not
used until the next gz* read, write, seek, or close operation, so gzdopen
will not detect if fd is invalid (unless fd is -1).
*/
ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
/*
Set the internal buffer size used by this library's functions. The
default buffer size is 8192 bytes. This function must be called after
gzopen() or gzdopen(), and before any other calls that read or write the
file. The buffer memory allocation is always deferred to the first read or
write. Two buffers are allocated, either both of the specified size when
writing, or one of the specified size and the other twice that size when
reading. A larger buffer size of, for example, 64K or 128K bytes will
noticeably increase the speed of decompression (reading).
The new buffer size also affects the maximum length for gzprintf().
gzbuffer() returns 0 on success, or -1 on failure, such as being called
too late.
*/
ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
/*
Dynamically update the compression level or strategy. See the description
of deflateInit2 for the meaning of these parameters.
gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
opened for writing.
*/
ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
/*
Reads the given number of uncompressed bytes from the compressed file. If
the input file was not in gzip format, gzread copies the given number of
bytes into the buffer.
After reaching the end of a gzip stream in the input, gzread will continue
to read, looking for another gzip stream, or failing that, reading the rest
of the input file directly without decompression. The entire input file
will be read if gzread is called until it returns less than the requested
len.
gzread returns the number of uncompressed bytes actually read, less than
len for end of file, or -1 for error.
*/
ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
voidpc buf, unsigned len));
/*
Writes the given number of uncompressed bytes into the compressed file.
gzwrite returns the number of uncompressed bytes written or 0 in case of
error.
*/
ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
/*
Converts, formats, and writes the arguments to the compressed file under
control of the format string, as in fprintf. gzprintf returns the number of
uncompressed bytes actually written, or 0 in case of error. The number of
uncompressed bytes written is limited to 8191, or one less than the buffer
size given to gzbuffer(). The caller should assure that this limit is not
exceeded. If it is exceeded, then gzprintf() will return an error (0) with
nothing written. In this case, there may also be a buffer overflow with
unpredictable consequences, which is possible only if zlib was compiled with
the insecure functions sprintf() or vsprintf() because the secure snprintf()
or vsnprintf() functions were not available. This can be determined using
zlibCompileFlags().
*/
ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
/*
Writes the given null-terminated string to the compressed file, excluding
the terminating null character.
gzputs returns the number of characters written, or -1 in case of error.
*/
ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
/*
Reads bytes from the compressed file until len-1 characters are read, or a
newline character is read and transferred to buf, or an end-of-file
condition is encountered. If any characters are read or if len == 1, the
string is terminated with a null character. If no characters are read due
to an end-of-file or len < 1, then the buffer is left untouched.
gzgets returns buf which is a null-terminated string, or it returns NULL
for end-of-file or in case of error. If there was an error, the contents at
buf are indeterminate.
*/
ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
/*
Writes c, converted to an unsigned char, into the compressed file. gzputc
returns the value that was written, or -1 in case of error.
*/
ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
/*
Reads one byte from the compressed file. gzgetc returns this byte or -1
in case of end of file or error.
*/
ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
/*
Push one character back onto the stream to be read as the first character
on the next read. At least one character of push-back is allowed.
gzungetc() returns the character pushed, or -1 on failure. gzungetc() will
fail if c is -1, and may fail if a character has been pushed but not read
yet. If gzungetc is used immediately after gzopen or gzdopen, at least the
output buffer size of pushed characters is allowed. (See gzbuffer above.)
The pushed character will be discarded if the stream is repositioned with
gzseek() or gzrewind().
*/
ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
/*
Flushes all pending output into the compressed file. The parameter flush
is as in the deflate() function. The return value is the zlib error number
(see function gzerror below). gzflush is only permitted when writing.
If the flush parameter is Z_FINISH, the remaining data is written and the
gzip stream is completed in the output. If gzwrite() is called again, a new
gzip stream will be started in the output. gzread() is able to read such
concatented gzip streams.
gzflush should be called only when strictly necessary because it will
degrade compression if called too often.
*/
/*
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
z_off_t offset, int whence));
Sets the starting position for the next gzread or gzwrite on the given
compressed file. The offset represents a number of bytes in the
uncompressed data stream. The whence parameter is defined as in lseek(2);
the value SEEK_END is not supported.
If the file is opened for reading, this function is emulated but can be
extremely slow. If the file is opened for writing, only forward seeks are
supported; gzseek then compresses a sequence of zeroes up to the new
starting position.
gzseek returns the resulting offset location as measured in bytes from
the beginning of the uncompressed stream, or -1 in case of error, in
particular if the file is opened for writing and the new starting position
would be before the current position.
*/
ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
/*
Rewinds the given file. This function is supported only for reading.
gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
*/
/*
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
Returns the starting position for the next gzread or gzwrite on the given
compressed file. This position represents a number of bytes in the
uncompressed data stream, and is zero when starting, even if appending or
reading a gzip stream from the middle of a file using gzdopen().
gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
*/
/*
ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
Returns the current offset in the file being read or written. This offset
includes the count of bytes that precede the gzip stream, for example when
appending or when using gzdopen() for reading. When reading, the offset
does not include as yet unused buffered input. This information can be used
for a progress indicator. On error, gzoffset() returns -1.
*/
ZEXTERN int ZEXPORT gzeof OF((gzFile file));
/*
Returns true (1) if the end-of-file indicator has been set while reading,
false (0) otherwise. Note that the end-of-file indicator is set only if the
read tried to go past the end of the input, but came up short. Therefore,
just like feof(), gzeof() may return false even if there is no more data to
read, in the event that the last read request was for the exact number of
bytes remaining in the input file. This will happen if the input file size
is an exact multiple of the buffer size.
If gzeof() returns true, then the read functions will return no more data,
unless the end-of-file indicator is reset by gzclearerr() and the input file
has grown since the previous end of file was detected.
*/
ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
/*
Returns true (1) if file is being copied directly while reading, or false
(0) if file is a gzip stream being decompressed. This state can change from
false to true while reading the input file if the end of a gzip stream is
reached, but is followed by data that is not another gzip stream.
If the input file is empty, gzdirect() will return true, since the input
does not contain a gzip stream.
If gzdirect() is used immediately after gzopen() or gzdopen() it will
cause buffers to be allocated to allow reading the file to determine if it
is a gzip file. Therefore if gzbuffer() is used, it should be called before
gzdirect().
*/
ZEXTERN int ZEXPORT gzclose OF((gzFile file));
/*
Flushes all pending output if necessary, closes the compressed file and
deallocates the (de)compression state. Note that once file is closed, you
cannot call gzerror with file, since its structures have been deallocated.
gzclose must not be called more than once on the same file, just as free
must not be called more than once on the same allocation.
gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
file operation error, or Z_OK on success.
*/
ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
/*
Same as gzclose(), but gzclose_r() is only for use when reading, and
gzclose_w() is only for use when writing or appending. The advantage to
using these instead of gzclose() is that they avoid linking in zlib
compression or decompression code that is not used when only reading or only
writing respectively. If gzclose() is used, then both compression and
decompression code will be included the application when linking to a static
zlib library.
*/
ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
/*
Returns the error message for the last error which occurred on the given
compressed file. errnum is set to zlib error number. If an error occurred
in the file system and not in the compression library, errnum is set to
Z_ERRNO and the application may consult errno to get the exact error code.
The application must not modify the returned string. Future calls to
this function may invalidate the previously returned string. If file is
closed, then the string previously returned by gzerror will no longer be
available.
gzerror() should be used to distinguish errors from end-of-file for those
functions above that do not distinguish those cases in their return values.
*/
ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
/*
Clears the error and end-of-file flags for file. This is analogous to the
clearerr() function in stdio. This is useful for continuing to read a gzip
file that is being written concurrently.
*/
/* checksum functions */
/*
These functions are not related to compression but are exported
anyway because they might be useful in applications using the compression
library.
*/
ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
/*
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
return the updated checksum. If buf is Z_NULL, this function returns the
required initial value for the checksum.
An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
much faster.
Usage example:
uLong adler = adler32(0L, Z_NULL, 0);
while (read_buffer(buffer, length) != EOF) {
adler = adler32(adler, buffer, length);
}
if (adler != original_adler) error();
*/
/*
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
z_off_t len2));
Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
*/
ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
/*
Update a running CRC-32 with the bytes buf[0..len-1] and return the
updated CRC-32. If buf is Z_NULL, this function returns the required
initial value for the for the crc. Pre- and post-conditioning (one's
complement) is performed within this function so it shouldn't be done by the
application.
Usage example:
uLong crc = crc32(0L, Z_NULL, 0);
while (read_buffer(buffer, length) != EOF) {
crc = crc32(crc, buffer, length);
}
if (crc != original_crc) error();
*/
/*
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
Combine two CRC-32 check values into one. For two sequences of bytes,
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
len2.
*/
/* various hacks, don't look :) */
/* deflateInit and inflateInit are macros to allow checking the zlib version
* and the compiler's view of z_stream:
*/
ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
const char *version, int stream_size));
ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
const char *version, int stream_size));
ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
int windowBits, int memLevel,
int strategy, const char *version,
int stream_size));
ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
const char *version, int stream_size));
ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
unsigned char FAR *window,
const char *version,
int stream_size));
#define deflateInit(strm, level) \
deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
#define inflateInit(strm) \
inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
(strategy), ZLIB_VERSION, sizeof(z_stream))
#define inflateInit2(strm, windowBits) \
inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
#define inflateBackInit(strm, windowBits, window) \
inflateBackInit_((strm), (windowBits), (window), \
ZLIB_VERSION, sizeof(z_stream))
/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
* change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
* both are true, the application gets the *64 functions, and the regular
* functions are changed to 64 bits) -- in case these are set on systems
* without large file support, _LFS64_LARGEFILE must also be true
*/
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
#endif
#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0
# define gzopen gzopen64
# define gzseek gzseek64
# define gztell gztell64
# define gzoffset gzoffset64
# define adler32_combine adler32_combine64
# define crc32_combine crc32_combine64
# ifdef _LARGEFILE64_SOURCE
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
# endif
#else
ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
#endif
/* hack for buggy compilers */
#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
struct internal_state {int dummy;};
#endif
/* undocumented functions */
ZEXTERN const char * ZEXPORT zError OF((int));
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
#ifdef __cplusplus
}
#endif
#endif /* ZLIB_H */
sra_sdk-2.1.7/interfaces/insdc/ 0000755 0012213 0011620 00000000000 11542741623 016063 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/insdc/insdc.h 0000644 0012213 0011620 00000014465 11645077605 017354 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_insdc_insdc_
#define _h_insdc_insdc_
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*==========================================================================
* INSDC types, constants
*/
/*--------------------------------------------------------------------------
* dna
* represented in IUPAC characters
*/
typedef char INSDC_dna_text;
/*--------------------------------------------------------------------------
* 4na
* nucleotide data with all possible ambiguity
* does not represent all possible EVENTS
*
* text encodings use the IUPAC character set
* legal values: [ACMGRSVTWYHKDBNacmgrsvtwyhkdbn.]
* canonical values: [ACMGRSVTWYHKDBN]
*
* binary values are 0..15 = { NACMGRSVTWYHKDBN }
*
* 4na values use bits for each letter:
*
* A | C | G | T
* =================
* N | | |
* A * | | |
* C | * | |
* M * | * | |
* G | | * |
* R * | | * |
* S | * | * |
* V * | * | * |
* T | | | *
* W * | | | *
* Y | * | | *
* H * | * | | *
* K | | * | *
* D * | | * | *
* B | * | * | *
* N * | * | * | *
*
* packed bytes have first base in upper nibble,
* and the following base in lower nibble.
*
* bit: 76543210 76543210 76543210
* ================================
* base: 00001111 22223333 44445555 etc.
*
* element offsets follow this pattern
*/
typedef uint8_t INSDC_4na_bin;
typedef uint8_t INSDC_4na_packed;
#define INSDC_4na_map_BINSET \
{ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 }
#define INSDC_4na_map_CHARSET \
".ACMGRSVTWYHKDBN"
#define INSDC_4na_accept_CHARSET \
".ACMGRSVTWYHKDBNacmgrsvtwyhkdbn"
/*--------------------------------------------------------------------------
* 2na
* nucleotide data { ATGC }
* x2na
* nucleotide data with single ambiguity value
*
* text encodings use the IUPAC character set
* legal values: [ACGTNacgtn.]
* canonical values: [ACGTN]
*
* binary values are 0..4 = { ACGTN }
*
* packed values exclude N:
* A = 0
* C = 1
* G = 2
* T = 3
*
* packed bytes have first base in uppermost 2 bits,
* and the following bases in similar fashion:
*
* bit: 76543210 76543210
* =======================
* base: 00112233 44556677 etc.
*
* element offsets follow this pattern
*/
typedef uint8_t INSDC_2na_bin;
typedef uint8_t INSDC_x2na_bin;
typedef uint8_t INSDC_2na_packed;
#define INSDC_2na_map_BINSET \
{ 0,1,2,3 }
#define INSDC_2na_map_CHARSET \
"ACGT"
#define INSDC_2na_accept_CHARSET \
"ACGTacgt"
#define INSDC_x2na_map_BINSET \
{ 0,1,2,3,4 }
#define INSDC_x2na_map_CHARSET \
"ACGTN"
#define INSDC_x2na_accept_CHARSET \
"ACGTNacgtn."
/*--------------------------------------------------------------------------
* color
* color-space data
* 2cs
* color-space data 0,1,2,3
* x2cs
* color-space data extended with single ambiguity value (.)
*
* text encodings use the ASCII numeric character set
* values: [0123.]
*
* x2cs values are 0..4 = { 0123. }
*
* 2cs values exclude '.':
* '0' = 0
* '1' = 1
* '2' = 2
* '3' = 3
*/
typedef char INSDC_color_text;
typedef uint8_t INSDC_2cs_bin;
typedef uint8_t INSDC_x2cs_bin;
typedef uint8_t INSDC_2cs_packed;
#define INSDC_2cs_map_BINSET \
{ 0,1,2,3 }
#define INSDC_2cs_map_CHARSET \
"0123"
#define INSDC_2cs_accept_CHARSET \
"0123"
#define INSDC_x2cs_map_BINSET \
{ 0,1,2,3,4 }
#define INSDC_x2cs_map_CHARSET \
"0123."
#define INSDC_x2cs_accept_CHARSET \
"0123."
#define INSDC_color_default_matrix \
{ \
0, 1, 2, 3, 4, \
1, 0, 3, 2, 4, \
2, 3, 0, 1, 4, \
3, 2, 1, 0, 4, \
4, 4, 4, 4, 4 \
}
/*--------------------------------------------------------------------------
* protein
* represented in IUPAC characters
*/
typedef char INSDC_protein_text;
/*--------------------------------------------------------------------------
* aa
* protein data
* text encodings use the IUPAC character set
*/
typedef uint8_t INSDC_aa_bin;
#define INSDC_aa_map_BINSET \
{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25 }
#define INSDC_aa_map_CHARSET \
"ABCDEFGHIKLMNPQRSTVWXYZU*"
#define INSDC_aa_accept_CHARSET \
"ABCDEFGHIKLMNPQRSTVWXYZU*abcdefghiklmnpqrstvwxyzu"
/*--------------------------------------------------------------------------
* quality
* quality scoring values
*
* phred legal values_ 0..63
*/
typedef uint8_t INSDC_quality_phred;
typedef int8_t INSDC_quality_log_odds;
/*--------------------------------------------------------------------------
* coordinate
* zero and one based coordinates
* lengths are expressed as unsigned quantities
*/
typedef int32_t INSDC_coord_val;
typedef uint32_t INSDC_coord_len;
typedef INSDC_coord_val INSDC_coord_zero;
typedef INSDC_coord_val INSDC_coord_one;
typedef INSDC_coord_zero INSDC_position_zero;
typedef INSDC_coord_one INSDC_position_one;
#ifdef __cplusplus
}
#endif
#endif /* _h_insdc_insdc_ */
sra_sdk-2.1.7/interfaces/insdc/insdc.vschema 0000644 0012213 0011620 00000013756 11645077605 020555 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
/*==========================================================================
* INSDC types, constants
*/
version 1;
/*--------------------------------------------------------------------------
* dna
* represented in IUPAC characters
*/
typedef ascii INSDC:dna:text;
/*--------------------------------------------------------------------------
* 4na
* nucleotide data with all possible ambiguity
* does not represent all possible EVENTS
*
* text encodings use the IUPAC character set
* legal values: [ACMGRSVTWYHKDBNacmgrsvtwyhkdbn.]
* canonical values: [ACMGRSVTWYHKDBN]
*
* binary values are 0..15 = { NACMGRSVTWYHKDBN }
*
* 4na values use bits for each letter:
*
* A | C | G | T
* =================
* N | | |
* A * | | |
* C | * | |
* M * | * | |
* G | | * |
* R * | | * |
* S | * | * |
* V * | * | * |
* T | | | *
* W * | | | *
* Y | * | | *
* H * | * | | *
* K | | * | *
* D * | | * | *
* B | * | * | *
* N * | * | * | *
*/
typedef U8 INSDC:4na:bin;
typedef B1 INSDC:4na:packed [ 4 ];
const INSDC:4na:bin INSDC:4na:map:BINSET
= [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 ];
const INSDC:dna:text INSDC:4na:map:CHARSET
= ".ACMGRSVTWYHKDBN";
const INSDC:dna:text INSDC:4na:accept:CHARSET
= ".ACMGRSVTWYHKDBNacmgrsvtwyhkdbn";
/*--------------------------------------------------------------------------
* 2na - nucleotide data A,T,G,C
* x2na - nucleotide data extended with single ambiguity value (N)
*
* text encodings use the IUPAC character set
* legal values: [ACGTNacgtn.]
* canonical values: [ACGTN]
*
* x2na values are 0..4 = { ACGTN }
*
* 2na values exclude N:
* A = 0
* C = 1
* G = 2
* T = 3
*/
typedef U8 INSDC:2na:bin;
typedef U8 INSDC:x2na:bin;
typedef B1 INSDC:2na:packed [ 2 ];
const INSDC:2na:bin INSDC:2na:map:BINSET = [ 0,1,2,3 ];
const INSDC:dna:text INSDC:2na:map:CHARSET = "ACGT";
const INSDC:dna:text INSDC:2na:accept:CHARSET = "ACGTacgt";
const INSDC:x2na:bin INSDC:x2na:map:BINSET = [ 0,1,2,3,4 ];
const INSDC:dna:text INSDC:x2na:map:CHARSET = "ACGTN";
const INSDC:dna:text INSDC:x2na:accept:CHARSET = "ACGTNacgtn.";
/*--------------------------------------------------------------------------
* color - color-space text
* 2cs - color-space data 0,1,2,3
* x2cs - color-space data extended with single ambiguity value (.)
*
* text encodings use the ASCII numeric character set
* values: [0123.]
*
* x2cs values are 0..4 = { 0123. }
*
* 2cs values exclude '.':
* '0' = 0
* '1' = 1
* '2' = 2
* '3' = 3
*/
typedef ascii INSDC:color:text;
typedef U8 INSDC:2cs:bin;
typedef U8 INSDC:x2cs:bin;
typedef B1 INSDC:2cs:packed [ 2 ];
const INSDC:2cs:bin INSDC:2cs:map:BINSET = [ 0,1,2,3 ];
const INSDC:color:text INSDC:2cs:map:CHARSET = "0123";
const INSDC:color:text INSDC:2cs:accept:CHARSET = "0123";
const INSDC:x2cs:bin INSDC:x2cs:map:BINSET = [ 0,1,2,3,4 ];
const INSDC:color:text INSDC:x2cs:map:CHARSET = "0123.";
const INSDC:color:text INSDC:x2cs:accept:CHARSET = "0123.";
const U8 INSDC:color:default_matrix =
[
0, 1, 2, 3, 4,
1, 0, 3, 2, 4,
2, 3, 0, 1, 4,
3, 2, 1, 0, 4,
4, 4, 4, 4, 4
];
/*--------------------------------------------------------------------------
* protein
* represented in IUPAC characters
*/
typedef ascii INSDC:protein:text;
/*--------------------------------------------------------------------------
* aa
* protein data
* text encodings use the IUPAC character set
*/
typedef U8 INSDC:aa:bin;
const INSDC:aa:bin INSDC:aa:map:BINSET
= [ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25 ];
const INSDC:protein:text INSDC:aa:map:CHARSET
= "ABCDEFGHIKLMNPQRSTVWXYZU*";
const INSDC:protein:text INSDC:aa:accept:CHARSET
= "ABCDEFGHIKLMNPQRSTVWXYZU*abcdefghiklmnpqrstvwxyzu";
/*--------------------------------------------------------------------------
* quality
* quality scoring values
*
* phred legal values: 0..63
*/
typedef U8 INSDC:quality:phred;
typedef I8 INSDC:quality:log_odds;
// text-encoding of quality scores
// offsets are 33 = '!' and 64 = '@'
typedef ascii INSDC:quality:text:phred_33;
typedef ascii INSDC:quality:text:phred_64;
typedef ascii INSDC:quality:text:log_odds_64;
/*--------------------------------------------------------------------------
* coordinate
* zero and one based coordinates
*/
// 32 bit coordinates
typedef I32 INSDC:coord:val;
typedef U32 INSDC:coord:len;
// zero or one based coordinate system
typedef INSDC:coord:val INSDC:coord:zero;
typedef INSDC:coord:val INSDC:coord:one;
// POSITION types for relating bases to their location in signal
typedef INSDC:coord:zero INSDC:position:zero;
typedef INSDC:coord:one INSDC:position:one;
sra_sdk-2.1.7/interfaces/insdc/sra.vschema 0000644 0012213 0011620 00000032555 11632420654 020230 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
/*==========================================================================
* INSDC Sequence Read Archive schema
*/
version 1;
include 'insdc/seq.vschema';
/*--------------------------------------------------------------------------
* types
*/
/* spotid_t
* unique id given to every spot
*/
typedef U32 INSDC:SRA:spotid_t;
/* spot_ids_found
*/
typedef U64 INSDC:SRA:spot_ids_found [ 4 ];
/*--------------------------------------------------------------------------
* functions
*/
/* format_spot_name
* given a name format string, X, and Y
* produce a reconstructed spot name string
*
* "name_fmt" [ DATA ] - name format string ( see format explanation below )
*
* "X" [ DATA ] - X coordinate for spot
*
* "Y" [ DATA ] - Y coordinate for spot
*
* "spot_name" [ DATA, OPTIONAL ] - potential source of unformatted names
*
* SYNOPSIS:
* "name_fmt" may have any ASCII characters
* the special character '$' is an escape symbol
* when followed by a recognized format character,
* both the '$' and its format character will be
* replaced with a numeral generated from X and/or Y.
*
* when "spot_name" is present and the "name_fmt" row is empty,
* output is taken verbatim from "spot_name"
*/
function
ascii INSDC:SRA:format_spot_name #1 ( ascii name_fmt , I32 X , I32 Y * ascii spot_name );
function
ascii INSDC:SRA:format_spot_name_no_coord #1 ( ascii name_fmt * ascii spot_name );
/*--------------------------------------------------------------------------
* spotcoord
* spot coordinate table
* gives X and Y and potentially other common coordinates
*/
table INSDC:SRA:tbl:spotcoord #1
{
/* X, Y
* 32 ( or 16 ) bit coordinates within plate region
* the coordinate system ( zero or one-based ) is unspecified
*/
extern default column INSDC:coord:val X = out_x_coord;
extern default column INSDC:coord:val Y = out_y_coord;
// backward compatibility for 16-bit unsigned coordinates
extern readonly column U16 X = cast ( x_clip_U16 );
extern readonly column U16 Y = cast ( y_clip_U16 );
// clip signed 32-bit coordinates to unsigned 16-bit
INSDC:coord:val x_clip_U16
= < INSDC:coord:val > clip < 0, 0xFFFF > ( out_x_coord );
INSDC:coord:val y_clip_U16
= < INSDC:coord:val > clip < 0, 0xFFFF > ( out_y_coord );
/* INSDC:SRA:tbl:spotcoord virtual productions
* out_x_coord
* out_y_coord
*/
};
/*--------------------------------------------------------------------------
* spotname
* spot name table
* the name column is normally indexed
*
* history:
* 1.0.1 - split X and Y into spotcoord table
*/
table INSDC:SRA:tbl:spotname #1.0.1 = INSDC:SRA:tbl:spotcoord #1
{
/* NAME
* external name for spot
*/
extern column ascii NAME = _out_name;
/* SPOT_IDS_FOUND
* lookup by NAME column
*/
readonly column INSDC:SRA:spot_ids_found SPOT_IDS_FOUND
= spot_ids_found;
/* default rules */
// assemble NAME column output in order of preference
ascii _out_name
= INSDC:SRA:format_spot_name ( out_name_fmt, out_x_coord, out_y_coord, out_spot_name )
| INSDC:SRA:format_spot_name ( out_name_fmt, out_x_coord, out_y_coord )
| INSDC:SRA:format_spot_name_no_coord (out_name_fmt)
| out_spot_name;
/* INSDC:SRA:tbl:spotcoord inherited virtual productions
* out_x_coord
* out_y_coord
*/
/* INSDC:SRA:tbl:spotname virtual productions
* out_name_fmt
* out_spot_name
* spot_ids_found
*/
};
/*--------------------------------------------------------------------------
* spotdesc
* spot descriptor table
*
* history:
* 1.0.1 - base explicitly upon sequence #1.0.1
* 1.0.2 - added alternate taps for in_read_type and in_read_len
*/
// read filter bits
typedef U8 INSDC:SRA:read_filter;
const INSDC:SRA:read_filter SRA_READ_FILTER_PASS = 0;
const INSDC:SRA:read_filter SRA_READ_FILTER_REJECT = 1;
const INSDC:SRA:read_filter SRA_READ_FILTER_CRITERIA = 2;
const INSDC:SRA:read_filter SRA_READ_FILTER_REDACTED = 3;
// read type bits
typedef U8 INSDC:SRA:xread_type;
const INSDC:SRA:xread_type SRA_READ_TYPE_TECHNICAL = 0;
const INSDC:SRA:xread_type SRA_READ_TYPE_BIOLOGICAL = 1;
const INSDC:SRA:xread_type SRA_READ_TYPE_FORWARD = 2;
const INSDC:SRA:xread_type SRA_READ_TYPE_REVERSE = 4;
// original read-types included only technical and biological
typedef INSDC:SRA:xread_type INSDC:SRA:read_type;
table INSDC:SRA:tbl:spotdesc #1.0.2 = INSDC:tbl:sequence #1.0.1
{
/* NREADS
* describes the number of reads within spot
*/
extern column U8 NREADS = out_nreads;
/* SPOT_LEN
* length of sequence
* FIXED_SPOT_LEN
* non-zero if sequence length is fixed throughout table
*/
readonly column INSDC:coord:len SPOT_LEN = spot_len;
readonly column INSDC:coord:len FIXED_SPOT_LEN = fixed_spot_len;
/* TRIM_START
* TRIM_LEN
* define the spot segment after applying trimming
* trimming may be based upon technical segments and read quality
*/
readonly column INSDC:coord:zero TRIM_START
= trim_start
| < INSDC:coord:zero> echo < 0 > ();
readonly column INSDC:coord:one TRIM_START
= ( INSDC:coord:one ) < I32 > sum < 1 > ( trim_start )
| < INSDC:coord:one> echo < 1 > ();
readonly column INSDC:coord:len TRIM_LEN
= trim_len
| spot_len;
/* LABEL
* LABEL_START, LABEL_LEN
* column pair for writing read labels
* the label text for all reads is concatenated to form the LABEL row
* starting coordinates and lengths delineate labels by read
*
* NB - row length for LABEL_START/LEN === NREADS,
* row length for LABEL === SUM ( LABEL_LEN [ n ] ) for NREADS
*/
extern column ascii LABEL = out_label;
extern column INSDC:coord:zero LABEL_START = out_label_start;
extern column INSDC:coord:len LABEL_LEN = out_label_len;
// 16-bit versions
readonly column U16 LABEL_START = cast ( out_label_start );
readonly column U16 LABEL_LEN = cast ( out_label_len );
/* READ_TYPE
* binary values giving type of a read
*
* NB - row length === NREADS
*/
extern default column INSDC:SRA:xread_type READ_TYPE = out_read_type;
INSDC:SRA:xread_type in_read_type
= READ_TYPE
| _alt_in_read_type;
readonly column INSDC:SRA:read_type READ_TYPE
= out_read_type
| < INSDC:SRA:xread_type, INSDC:SRA:read_type > map < [ 0,1,2,3,4,5,6,7 ], [ 0,1,0,1,0,1,0,1 ] > ( out_read_type );
/* READ_START
* READ_LEN
* define starting coordinates and length of read segments
*
* NB - row length === NREADS
*/
extern default column INSDC:coord:zero READ_START
= out_read_start;
extern column INSDC:coord:one READ_START
= ( INSDC:coord:one ) < I32 > sum < 1 > ( out_read_start );
extern column INSDC:coord:len READ_LEN = out_read_len;
// 16-bit versions
readonly column U16 READ_START = cast ( out_read_start );
readonly column U16 READ_LEN = cast ( out_read_len );
INSDC:coord:len in_read_len
= READ_LEN
| _alt_in_read_len;
/* READ_FILTER
* bits indicate usability of sequence
* always available
*/
extern column INSDC:SRA:read_filter READ_FILTER
= out_rd_filter
| < INSDC:SRA:read_filter > echo < SRA_READ_FILTER_PASS > ( out_read_start );
// RD_FILTER - only available if physical column is present
extern readonly column INSDC:SRA:read_filter RD_FILTER = out_rd_filter;
/* spot_len is used internally */
INSDC:coord:len spot_len
= base_space_spot_len
| color_space_spot_len
| align_spot_len;
INSDC:coord:len fixed_spot_len
= static_fixed_spot_len
| base_space_fixed_spot_len
| color_space_fixed_spot_len;
/* INSDC:tbl:sequence inherited virtual productions
* out_2cs_packed
* out_2na_packed
*/
/* INSDC:SRA:tbl:spotdesc productions
* trim_len
* out_label
* out_nreads
* trim_start
* out_read_len
* out_label_len
* out_rd_filter
* out_read_type
* out_read_start
* out_label_start
* static_fixed_spot_len
*/
};
/*--------------------------------------------------------------------------
* stats
* run and spot-group statistics
*
* history:
* 1.1.0 - added CMP_BASE_COUNT
*/
table INSDC:SRA:tbl:stats #1.1
{
readonly column INSDC:SRA:spotid_t MIN_SPOT_ID
= min_spot_id
| < INSDC:SRA:spotid_t > echo < 1 > ();
readonly column INSDC:SRA:spotid_t MAX_SPOT_ID
= max_spot_id
| cast ( spot_count );
readonly column U64
SPOT_COUNT = spot_count;
readonly column U64
BASE_COUNT = base_count;
readonly column U64
BIO_BASE_COUNT = bio_base_count;
readonly column U64 CMP_BASE_COUNT
= cmp_base_count
| base_count;
U8 stats_dummy = in_stats_bin;
/* INSDC:SRA:tbl:stats productions
* base_count
* spot_count
* max_spot_id
* min_spot_id
* in_stats_bin
* bio_base_count
* cmp_base_count
*/
};
/*--------------------------------------------------------------------------
* sra
* the INSDC SRA table
*
* history:
* 1.0.1 - base explicitly upon spotname #1.0.1
* 1.0.2 - base explicitly upon sequence #1.0.1, spotdesc #1.0.1
* 1.0.3 - base upon spotdesc #1.0.2
*/
// platform constants from
typedef U8 INSDC:SRA:platform_id;
const INSDC:SRA:platform_id SRA_PLATFORM_UNDEFINED = 0;
const INSDC:SRA:platform_id SRA_PLATFORM_454 = 1;
const INSDC:SRA:platform_id SRA_PLATFORM_ILLUMINA = 2;
const INSDC:SRA:platform_id SRA_PLATFORM_ABSOLID = 3;
const INSDC:SRA:platform_id SRA_PLATFORM_COMPLETE_GENOMICS = 4;
const INSDC:SRA:platform_id SRA_PLATFORM_HELICOS = 5;
const INSDC:SRA:platform_id SRA_PLATFORM_PACBIO_SMRT = 6;
const INSDC:SRA:platform_id SRA_PLATFORM_ION_TORRENT = 7;
table INSDC:SRA:tbl:sra #1.0.3 =
INSDC:tbl:sequence #1.0.1, INSDC:SRA:tbl:spotname #1.0.1,
INSDC:SRA:tbl:spotdesc #1.0.2, INSDC:SRA:tbl:stats #1.1.0
{
/* PLATFORM
* platform description
* one version returns a constant defined above
* while the other returns a textual representation
*/
extern column INSDC:SRA:platform_id PLATFORM
= .PLATFORM
| out_platform;
readonly column ascii PLATFORM
= platform_name;
physical column
< INSDC:SRA:platform_id > zip_encoding .PLATFORM = PLATFORM;
/* SPOT_ID
* reports spot id of current row
*/
extern column INSDC:SRA:spotid_t SPOT_ID
= < INSDC:SRA:spotid_t > add_row_id ( .SPOT_ID )
| cast ( rowid_64 );
I64 rowid_64 = row_id ();
physical column < INSDC:SRA:spotid_t > izip_encoding .SPOT_ID
= < INSDC:SRA:spotid_t > sub_row_id ( SPOT_ID );
/* SPOT_GROUP
* a name denoting group membership, ''
* used for "barcode" support
*/
extern column ascii SPOT_GROUP
= out_spot_group
| .SPOT_GROUP
| < ascii > echo < '' > ();
ascii in_spot_group = SPOT_GROUP;
physical column
< ascii > zip_encoding < Z_DEFAULT_STRATEGY, Z_BEST_SPEED > .SPOT_GROUP = in_spot_group;
/* INSDC:tbl:sequence inherited virtual productions
* cs_native
* in_cs_key
* out_cs_key
* out_signal
* in_dna_text
* out_2cs_bin
* out_2na_bin
* out_4na_bin
* out_dna_text
* out_x2cs_bin
* out_x2na_bin
* in_color_text
* out_2cs_packed
* out_2na_packed
* out_4na_packed
* out_color_text
* out_qual_phred
* out_color_matrix
*/
/* INSDC:SRA:tbl:spotcoord inherited virtual productions
* out_x_coord
* out_y_coord
*/
/* INSDC:SRA:tbl:spotname inherited virtual productions
* out_name_fmt
* out_spot_name
* spot_ids_found
*/
/* INSDC:SRA:tbl:spotdesc inherited productions
* trim_len
* out_label
* out_nreads
* trim_start
* out_read_len
* out_label_len
* out_rd_filter
* out_read_type
* out_read_start
* out_label_start
* static_fixed_spot_len
*/
/* INSDC:SRA:tbl:stats inherited productions
* base_count
* spot_count
* max_spot_id
* min_spot_id
* in_stats_bin
* bio_base_count
*/
/* INSDC:SRA:tbl:sra productions
* out_platform
* platform_name
*/
};
sra_sdk-2.1.7/interfaces/insdc/seq.vschema 0000644 0012213 0011620 00000013720 11645077605 020234 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
/*==========================================================================
* Sequence schema
*/
version 1;
include 'vdb/vdb.vschema';
include 'insdc/insdc.vschema';
/*--------------------------------------------------------------------------
* rand_4na_2na
* converts 4na to 2na
*
* substitutes a random base for ambiguities
* from the bases allowed in the 4na.
*
* A | C | G | T
* =================
* N | | | # any base may be substituted
* A * | | | # always A
* C | * | | # always C
* M * | * | | # A or C
* G | | * | # always G
* R * | | * | # A or G
* S | * | * | # C or G
* V * | * | * | # A, C or G
* T | | | * # always T
* W * | | | * # A or T
* Y | * | | * # C or T
* H * | * | | * # A, C or T
* K | | * | * # G or T
* D * | | * | * # A, G or T
* B | * | * | * # C, G or T
* N * | * | * | * # any base may be substituted
*/
extern function
INSDC:2na:bin INSDC:SEQ:rand_4na_2na #1 ( INSDC:4na:bin rd_bin );
/*--------------------------------------------------------------------------
* sequence
* basic sequence table
*
* history:
* 1.0.1 - introduced text-mode QUALITY columns
*/
table INSDC:tbl:sequence #1.0.1
{
/* READ
* native or converted DNA sequence
*/
// default is IUPAC character representation
extern default column INSDC:dna:text READ
{
read = out_dna_text;
validate = < INSDC:dna:text > compare ( in_dna_text, out_dna_text );
}
// 4na representation - unpacked and packed
extern column INSDC:4na:bin READ = out_4na_bin;
extern column INSDC:4na:packed READ = out_4na_packed;
// x2na representation - 2na with ambiguity
extern column INSDC:x2na:bin READ = out_x2na_bin;
// 2na representation - 2na with no ambiguity - unpacked and packed
extern column INSDC:2na:bin READ = out_2na_bin;
extern column INSDC:2na:packed READ = out_2na_packed;
/* CSREAD
* native or converted color-space sequence
*/
// default is ASCII character representation
extern default column INSDC:color:text CSREAD
{
read = out_color_text;
validate = < INSDC:color:text > compare ( in_color_text, out_color_text );
}
// x2cs representation - 2cs with ambiguity
extern column INSDC:x2cs:bin CSREAD = out_x2cs_bin;
// 2cs representation - 2cs with no ambiguity - unpacked and packed
extern column INSDC:2cs:bin CSREAD = out_2cs_bin;
extern column INSDC:2cs:packed CSREAD = out_2cs_packed;
/* CS_NATIVE
* is color-space the native sequence space
*/
readonly column bool CS_NATIVE = cs_native;
/* CS_KEY
* leading call given in base-space
*/
extern column INSDC:dna:text CS_KEY
{
read = out_cs_key;
validate = < INSDC:dna:text > compare ( in_cs_key, out_cs_key );
}
/* COLOR_MATRIX
* matrix used for color-space conversions
*/
extern column U8 COLOR_MATRIX = out_color_matrix;
/* QUALITY
* base or color call qualities
*/
// PHRED is default
extern default column INSDC:quality:phred QUALITY = out_qual_phred;
// textual encodings
extern column INSDC:quality:text:phred_33 QUALITY
= out_qual_text_phred_33
| ( INSDC:quality:text:phred_33 ) < B8 > sum < 33 > ( out_qual_phred );
extern column INSDC:quality:text:phred_64 QUALITY
= out_qual_text_phred_64
| ( INSDC:quality:text:phred_64 ) < B8 > sum < 64 > ( out_qual_phred );
/* SIGNAL
* signal and intensity information is unspecified
*/
INSDC:coord:len signal_len
= ( INSDC:coord:len ) row_len ( out_signal )
| < INSDC:coord:len > echo < 0 > ();
/* VIRTUAL PRODUCTIONS
* cs_native
* in_cs_key
* out_cs_key
* out_signal
* in_dna_text
* out_2cs_bin
* out_2na_bin
* out_4na_bin
* out_dna_text
* out_x2cs_bin
* out_x2na_bin
* in_color_text
* out_2cs_packed
* out_2na_packed
* out_4na_packed
* out_color_text
* out_qual_phred
* out_color_matrix
*/
};
/*--------------------------------------------------------------------------
* protein
* basic protein sequence table
*/
table INSDC:tbl:protein #1
{
/* PROTEIN
* native or converted protein sequence
*/
// default is IUPAC character representation
extern default column INSDC:protein:text PROTEIN
{
read = out_protein_text;
validate = < INSDC:protein:text > compare ( in_protein_text, out_protein_text );
}
// aa representation
extern column INSDC:aa:bin PROTEIN = out_aa_bin;
/* INSDC:tbl:protein productions
* out_aa_bin
* in_protein_text
* out_protein_text
*/
};
sra_sdk-2.1.7/interfaces/insdc/sra.h 0000664 0012213 0011620 00000005635 11550612417 017031 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_insdc_sra_
#define _h_insdc_sra_
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*==========================================================================
* INSDC SRA types, constants
*/
/* spotid_t
* unique id given to every spot
*/
typedef uint32_t INSDC_SRA_spotid_t;
/* spot_ids_found
* returns a tuple of spot ids
*/
typedef uint64_t INSDC_SRA_spot_ids_found [ 4 ];
/* read filter
*/
#define sra_read_filter_t "INSDC:SRA:read_filter"
typedef uint8_t INSDC_SRA_read_filter;
enum
{
SRA_READ_FILTER_PASS = 0,
SRA_READ_FILTER_REJECT = 1,
SRA_READ_FILTER_CRITERIA = 2,
SRA_READ_FILTER_REDACTED = 3
};
/* read type
* describes the type of read within a spot
* the extended version also describes its orientation
*/
#define sra_read_type_t "INSDC:SRA:xread_type"
typedef uint8_t INSDC_SRA_xread_type;
typedef INSDC_SRA_xread_type INSDC_SRA_read_type;
enum
{
/* read_type and xread_type */
SRA_READ_TYPE_TECHNICAL = 0,
SRA_READ_TYPE_BIOLOGICAL = 1,
/* xread_type only - applied as bits, e.g.:
type = SRA_READ_TYPE_BIOLOGICAL | SRA_READ_TYPE_REVERSE */
SRA_READ_TYPE_FORWARD = 2,
SRA_READ_TYPE_REVERSE = 4
};
/* platform id
*/
#define sra_platform_id_t "INSDC:SRA:platform_id"
typedef uint8_t INSDC_SRA_platform_id;
enum
{
SRA_PLATFORM_UNDEFINED = 0,
SRA_PLATFORM_454 = 1,
SRA_PLATFORM_ILLUMINA = 2,
SRA_PLATFORM_ABSOLID = 3,
SRA_PLATFORM_COMPLETE_GENOMICS = 4,
SRA_PLATFORM_HELICOS = 5,
SRA_PLATFORM_PACBIO_SMRT = 6,
SRA_PLATFORM_ION_TORRENT = 7
};
#ifdef __cplusplus
}
#endif
#endif /* _h_insdc_sra_ */
sra_sdk-2.1.7/interfaces/kapp/ 0000755 0012213 0011620 00000000000 11625217327 015717 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/kapp/args.h 0000644 0012213 0011620 00000021524 11625212552 017023 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kapp_args_
#define _h_kapp_args_
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Terminology for this module:
*
* On the command line all things typed in are arguments
* Those arguments that are string preceded by "-" or "--" are options
* The -- preceded version of an Option is that Option's name. A name
* can have one or more aliases that are a single character.
* The arguments that are not are parameters.
*
* This module treats all "strings" as if they were made of UTF-8 characters
* that can be one or more bytes long. An alias is a single Unicode character
* in UTF-8 format. 7-bit ASCII is a true subset of UTF-8. 8-but ASCII might
* not work.
*/
/* ==========
* Structure to define a command line option
*
* these are fed in one by one or through arrays to build up the
* tables used to parse the caommand line argc/argv
*/
typedef struct OptDef
{
const char * name; /* UTF8/ASCII NUL terminated long name */
const char * aliases; /* UTF8/ASCII NUL terminated set of single utf8/ASCII character names: may be NULL or "" */
void (CC * help_gen) (const char **); /* function to generate help string */
const char ** help; /* help-gen can treat these as non-const */
uint16_t max_count; /* maximum allowed; 0 is unlimited */
#define OPT_UNLIM 0
bool needs_value; /* does this require an argument value? */
bool required; /* is this a required parameter? Not supported yet. */
} OptDef;
extern OptDef StandardOptions [];
#define OPTION_DEBUG "debug"
#define OPTION_LOG_LEVEL "log-level"
#define OPTION_HELP "help"
#define OPTION_VERSION "version"
#define OPTION_VERBOSE "verbose"
#define ALIAS_DEBUG "+"
#define ALIAS_LOG_LEVEL "L"
#define ALIAS_HELP "h?"
#define ALIAS_HELP1 "h"
#define ALIAS_VERSION "V"
#define ALIAS_VERBOSE "v"
/*--------------------------------------------------------------------------
* Args
* opaque class to build up option lists and parse the command line argc/argv
* not reference counted
*/
typedef struct Args Args;
/* Make
* create the empty object
*/
rc_t CC ArgsMake ( Args ** pself );
/* Whack
* undo all object and owned object construction
*/
rc_t CC ArgsWhack ( Args * self );
/* AddOptionArray
* helper function to call the ArgsAddOption() multiple times
*/
rc_t CC ArgsAddOptionArray ( Args * self, const OptDef * option, uint32_t count
#if ADD_SOMETIME_LATER
, rc_t ( CC * header_fmt )( Args * args, const char * header ), const char * header
#endif
);
/* AddStandardOptions
* helper macro to add the arracy of internally defined
* "standard" options that we want all programs to support
*/
rc_t CC ArgsAddStandardOptions ( Args * self );
/* Parse
* parse the argc/argv as presented to KMain using the Args structure as built up
*/
rc_t CC ArgsParse ( Args * self, int argc, char *argv[] );
/* OptionCount
* how many times did this Option occur?
*/
rc_t CC ArgsOptionCount ( const Args * self, const char * option_name, uint32_t * count );
/* OptionValue
* what was the Nth value seen for this option?
* use OptionCount to know how many were seen.
*/
rc_t CC ArgsOptionValue ( const Args * self, const char * option_name,
uint32_t iteration, const char ** value );
/*
* ParamCount
* How many Parameters were seen?
*/
rc_t CC ArgsParamCount (const Args * self, uint32_t * count);
/*
* ParamValue
* What was the Nth parameter seen? Use ParamCount to know how many
* were seen.
*/
rc_t CC ArgsParamValue (const Args * self, uint32_t iteration, const char ** value_string);
/*
* ArgvCount
* This is the original main() argument count (argc or ac)
*/
rc_t CC ArgsArgvCount (const Args * self, uint32_t * count);
rc_t CC ArgsArgc (const Args * self, uint32_t * count);
#define ArgsArgc ArgsArgvCount
/*
* ArgvValue
* What was the Nth parameter seen? Use ArgvCount to know how many
* were seen.
*
* The 0th value will as with the original argc.argv c system be the program name
* as given to us by the O/S and c start up code.
*/
rc_t CC ArgsArgvValue (const Args * self, uint32_t iteration, const char ** value_string);
/* Utility functions to do common combinations and activities */
/*
* MakeStandardOptions
* Calls both Make() and AddStandardOptions()
*
* This is probably the first thing to do in KMain(), then add other Options
* via OptDef arracys and structures. Then call parse.
*/
rc_t CC ArgsMakeStandardOptions (Args** pself);
rc_t CC ArgsHandleHelp (Args * self);
rc_t CC ArgsHandleVersion (Args * self);
/*
* ArgsHandleLogLevel
* calls OptionCount and OptionValue to get parameters for the log-level
* option then uses that/those values to set the Log level for the log module
*/
rc_t CC ArgsHandleLogLevel (const Args * self);
rc_t CC ArgsHandleStatusLevel (const Args * self);
rc_t CC ArgsHandleDebug (const Args * self);
rc_t CC ArgsHandleStandardOptions (Args * self);
rc_t CC ArgsMakeAndHandle (Args ** pself, int argc, char ** argv, uint32_t table_count, ...);
rc_t CC ArgsMakeAndHandleStandardOptions (Args ** pself, int argc, char ** argv,
OptDef * options, uint32_t opt_count);
rc_t CC ArgsOptionSingleString (const Args * self, const char * option, const char ** value);
/* either fullpath or progname can be NULL, args can not */
rc_t CC ArgsProgram (const Args * args, const char ** fullpath, const char ** progname);
/*
* Help Interface:
* This interface is an extention os the Args Interface that is used for
* generating usage outputs for a command line program, This interface is provided
* to standardize the look of these usage messages.
*/
/*
* This function is defined per program and is the meat of the output
* the the short-form usage and the first part of the long-form usage
*
* It should look something like this:
*
*
* rc_t UsageSummary (const char * progname)
* {
* return KOutMsg ("\n"
* "Usage:\n"
* " %s [Options] [Parameters]\n"
* "\n"
* "Summary:\n"
* " Does something incredibly useful or we wouldn't have written it.\n"
* " I mean very very useful like pre-slicomg bread.\n",
* "\n", progname);
* }
*
* More than one example line can be present if desired.
*/
rc_t CC UsageSummary (const char * prog_name);
/*
* A program should define this which will be used only of the actual
* program name as called is somehow irretrievable
*/
extern const char UsageDefaultName[];
/*
* Version
* Generate the output for the -V or --version options.
* const char * fullpath: The full argv[0] name for the program
* ver_t version: the version for this program
*/
void CC HelpVersion (const char * fullpath, ver_t version);
void CC HelpOptionLine(const char * alias, const char * option, const char * param, const char ** msgs);
void CC HelpParamLine (const char * param, const char * const * msgs);
/*
* OptionsStandard
* output the option lines for the standard options
*/
void CC HelpOptionsStandard (void);
/*
* This Macro creates a default short form usage output typically
* used when no options/parameters are given for a program
*
* It requires 'void summary (const char * program_name)' that is also
* used in 'rc_t Usage (const Args* args)' that is the usage function
* called when -? -h or --help is given as an option on the command line
*/
rc_t CC MiniUsage ( const Args * args );
rc_t CC Usage ( const Args * args );
#ifdef __cplusplus
}
#endif
#endif /* _h_kapp_args_ */
sra_sdk-2.1.7/interfaces/kapp/main.h 0000644 0012213 0011620 00000012141 11576721672 017023 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kapp_main_
#define _h_kapp_main_
#ifndef _h_klib_defs_
#include
#endif
#ifndef _h_kapp_args_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* KMain
* invoked by platform specific "main" entrypoint
*/
/* Quitting
* is the program supposed to exit
*/
rc_t CC Quitting ( void );
/* SignalQuit
* tell the program to quit
*/
rc_t CC SignalQuit ( void );
/* Hangup
* has the program received a SIGHUP
*/
rc_t CC Hangup ( void );
/* SignalHup
* send the program a SIGHUP
*/
rc_t CC SignalHup ( void );
/* SignalNoHup
* tell the program to stay alive even after SIGHUP
*/
rc_t CC SignalNoHup ( void );
/* Version EXTERN
* return 4-part version code: 0xMMmmrrrr, where
* MM = major release
* mm = minor release
* rrrr = bug-fix release
*/
ver_t CC KAppVersion ( void );
/* KMain - EXTERN
* executable entrypoint "main" is implemented by
* an OS-specific wrapper that takes care of establishing
* signal handlers, logging, etc.
*
* in turn, OS-specific "main" will invoke "KMain" as
* platform independent main entrypoint.
*
* "argc" [ IN ] - the number of textual parameters in "argv"
* should never be < 0, but has been left as a signed int
* for reasons of tradition.
*
* "argv" [ IN ] - array of NUL terminated strings expected
* to be in the shell-native character set: ASCII or UTF-8
* element 0 is expected to be executable identity or path.
*/
rc_t CC KMain ( int argc, char *argv [] );
/* Usage - EXTERN
* This function is called when the command line argument
* handling sees -? -h or --help
*/
rc_t CC Usage ( struct Args const * args );
/* Version - EXTERN
* Obsolete: formerly called when the command line option handler
* saw -V or --version
*/
rc_t CC Version ( struct Args const * args );
/* AsciiToXXX
* replacement for atoi
* converts NUL terminated string in "arg" to integer
* invokes error handler if there is a format error in string
*
* "arg" [ IN ] - NUL terminated textual representation of integer
* obeys standard conversion rules:
* starts with "0x" or "0X" - interpret as hex
* starts with '0' - interpret as octal
* otherwise - interpret as decimal
*
* "handler_error" [ IN, NULL OKAY ] and "data" [ IN, OPAQUE ] -
* optional callback function to handle case where "arg" could not
* be processed in its entirety. default behavior is to log error
* using "logerr" and invoke "exit".
*/
int32_t CC AsciiToI32 ( const char *arg,
void ( CC * handle_error ) ( const char *arg, void *data ), void *data );
uint32_t CC AsciiToU32 ( const char *arg,
void ( CC * handle_error ) ( const char *arg, void *data ), void *data );
int64_t CC AsciiToI64 ( const char *arg,
void ( CC * handle_error ) ( const char *arg, void *data ), void *data );
uint64_t CC AsciiToU64 ( const char *arg,
void ( CC * handle_error ) ( const char *arg, void *data ), void *data );
/* NextLogLevel
* NextLogLevelh
* these match NextArg and NextArgh but take the parameter and use it
* to set the Log Level.
*
* legal values for the parameter are:
* 1. a sequence of + or - characters that each bump the current log level
* up or down one.
* 2. an integer with a decimal value from 0 to 13 (octal and hex with the
* same range are accepted.
* 3. fatal, err, warn, info, debug1, debug3, debug3, debug4, debug5, debug6
* debug7, debug8, debug9, debug10
*/
void CC NextLogLevel ( const char **argp, int *ip, int argc, char *argv [],
const char* ( CC * handle_null ) ( void *data ), void *data );
void CC NextLogLevelh ( int *ip, int argc, char *argv [],
const char* ( CC * handle_null ) ( void *data ), void *data );
#define LogLevelSet( S ) \
NextLogLevelCommon ( S )
rc_t CC NextLogLevelCommon ( const char * level_parameter );
#ifdef __cplusplus
}
#endif
#endif /* _h_kapp_main_ */
sra_sdk-2.1.7/interfaces/kapp/extern.h 0000644 0012213 0011620 00000003103 11576721672 017402 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kapp_extern_
#define _h_kapp_extern_
#if ! defined EXPORT_LATCH && defined _LIBRARY
#define KAPP_EXTERN LIB_EXPORT
#define KAPP_EXTERN_DATA extern LIB_EXPORT
#define EXPORT_LATCH 1
#else
#define KAPP_EXTERN LIB_IMPORT
#define KAPP_EXTERN_DATA LIB_IMPORT
#endif
#ifndef _h_klib_extern_
#include
#endif
#endif /* _h_kapp_extern_ */
sra_sdk-2.1.7/interfaces/kapp/progressbar.h 0000664 0012213 0011620 00000005156 11577660674 020447 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kapp_progressbar_
#define _h_kapp_progressbar_
#ifndef _h_kapp_extern_
#include
#endif
#ifndef _h_klib_log_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct KFile;
struct KDirectory;
typedef struct KLoadProgressbar KLoadProgressbar;
/**
Create new object in job
*/
KAPP_EXTERN rc_t CC KLoadProgressbar_Make(const KLoadProgressbar** cself, uint64_t size);
/**
if dir is NULL current directory assumed
*/
KAPP_EXTERN rc_t CC KLoadProgressbar_File(const KLoadProgressbar** cself, const char* filename, struct KDirectory const* dir);
KAPP_EXTERN rc_t CC KLoadProgressbar_KFile(const KLoadProgressbar** cself, struct KFile const* file);
/**
Release job object
if exclude than job stats excluded from reports
*/
KAPP_EXTERN void CC KLoadProgressbar_Release(const KLoadProgressbar* cself, bool exclude);
/**
Add a chunk of smth (bytes, rows, etc) to the job
*/
KAPP_EXTERN rc_t CC KLoadProgressbar_Append(const KLoadProgressbar* cself, uint64_t chunk);
/* Set severity level name
severity [IN] - default 'status'
*/
KAPP_EXTERN rc_t CC KLoadProgressbar_Severity(const char* severity);
/* mark a chunk of bytes as processed
report on full percent processed or if forced
*/
KAPP_EXTERN rc_t CC KLoadProgressbar_Process(const KLoadProgressbar* cself, uint64_t chunk, bool force_report);
#ifdef __cplusplus
}
#endif
#endif /* _h_kapp_progressbar_ */
sra_sdk-2.1.7/interfaces/kapp/loader-file.h 0000664 0012213 0011620 00000010575 11604623557 020270 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kapp_loader_file_
#define _h_kapp_loader_file_
#ifndef _h_kapp_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#include
#ifdef __cplusplus
extern "C" {
#endif
struct KDirectory;
/*--------------------------------------------------------------------------
* SRA reader buffered input file
*/
typedef struct KLoaderFile KLoaderFile;
KAPP_EXTERN rc_t CC KLoaderFile_Make(const KLoaderFile **file, struct KDirectory const* dir, const char* filename, const uint8_t* md5_digest);
KAPP_EXTERN rc_t CC KLoaderFile_Release(const KLoaderFile* cself, bool exclude_from_progress);
/* temporary close the file to avoid too many open files, but stay on position */
KAPP_EXTERN rc_t CC KLoaderFile_Close(const KLoaderFile* cself);
/* restart reading from beginning of the file */
KAPP_EXTERN rc_t CC KLoaderFile_Reset(const KLoaderFile* cself);
/* print error msg file file info and return original!! rc
if msg is NULL fmt is not used so call with NULL, NULL if no msg needs to be printed */
KAPP_EXTERN rc_t CC KLoaderFile_LOG(const KLoaderFile* cself, KLogLevel lvl, rc_t rc, const char *msg, const char *fmt, ...);
KAPP_EXTERN rc_t CC KLoaderFile_VLOG(const KLoaderFile* cself, KLogLevel lvl, rc_t rc, const char *msg, const char *fmt, va_list args);
/* returns true if eof is reached and buffer is empty */
KAPP_EXTERN rc_t CC KLoaderFile_IsEof(const KLoaderFile* cself, bool* eof);
/* returns current buffer position in file */
KAPP_EXTERN rc_t CC KLoaderFile_Offset(const KLoaderFile* cself, uint64_t* offset);
/* returns current line number in file */
KAPP_EXTERN rc_t CC KLoaderFile_Line(const KLoaderFile* cself, uint64_t* line);
/* file name */
KAPP_EXTERN rc_t CC KLoaderFile_Name(const KLoaderFile *self, const char **name);
/* file name completly resolved */
KAPP_EXTERN rc_t CC KLoaderFile_FullName(const KLoaderFile *self, const char **name);
/* Readline
* makes next line from a file available in buffer.
* eligable EOL symbols are: \n (unix), \r (older mac), \r\n (win)
* EOL symbol(s) never included in buffer length.
* if there is no EOL at EOF - not an error.
* fails if internal buffer is insufficient.
* buffer is NULL on EOF
* rc state of (rcString rcTooLong) means line was too long
* you may copy line and readline again for the tail of the line
*
* "buffer" [ OUT ] and "length" [ OUT ] - returned line and it's length
*/
KAPP_EXTERN rc_t CC KLoaderFile_Readline(const KLoaderFile* self, const void** buffer, size_t* length);
/* Read
* reads "size" bytes from file and makes them available through "buffer"
* if "advance" is > 0 than before reading skips "advance" bytes in file
* if "size" == 0 then nothing is read and available "length" bytes is returned in "buffer"
*
* "buffer" [ OUT ] - pointer to read bytes, "buffer" NULL means EOF
* "length" [ OUT ] - number of read bytes, normally == size,
if less than requested size, rc is [rcBuffer,rcInsufficient], advance and read more!
*/
KAPP_EXTERN rc_t CC KLoaderFile_Read(const KLoaderFile* self, size_t advance, size_t size, const void** buffer, size_t* length);
#ifdef __cplusplus
}
#endif
#endif /* _h_kapp_loader_file_ */
sra_sdk-2.1.7/interfaces/kapp/log-xml.h 0000664 0012213 0011620 00000004543 11577661031 017460 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kapp_log_xml_h_
#define _h_kapp_log_xml_h_
#ifndef _kapp_extern_
#include
#endif
#ifndef _kapp_args_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
KAPP_EXTERN_DATA const OptDef XMLLogger_Args [];
KAPP_EXTERN_DATA const size_t XMLLogger_ArgsQty;
typedef struct XMLLogger XMLLogger;
/*
Creates XML logging based on dir and command line
*/
KAPP_EXTERN rc_t CC XMLLogger_Make(const XMLLogger** cself, KDirectory* dir, const Args *args);
/*
Creates XML logging based on dir, logpath pair or fd directly
dir [IN,NULL] - directory object used to create and open logpath file
logpath [IN,NULL] - file name of the log file to _truncate_ and log into
fd [IN,NEGATIVE] - direct file descriptor, if < 0 than not set
if both logpath == NULL and fd < 0 than no XML log is produced normal log gets full inforamtion
*/
KAPP_EXTERN rc_t CC XMLLogger_Make2(const XMLLogger** cself, KDirectory* dir, const char* logpath, const int fd);
KAPP_EXTERN void CC XMLLogger_Usage(void);
KAPP_EXTERN void CC XMLLogger_Release(const XMLLogger* cself);
#ifdef __cplusplus
}
#endif
#endif /* _h_kapp_log_xml_h_ */
sra_sdk-2.1.7/interfaces/kapp/loader-meta.h 0000664 0012213 0011620 00000003326 11625217327 020270 0 ustar rodarmer trace /*==============================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kapp_loader_meta_
#define _h_kapp_loader_meta_
#ifndef _h_kapp_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct KMDataNode;
KAPP_EXTERN rc_t CC KLoaderMeta_Write(KMDataNode* root,
const char* argv0, const char* argv0_date,
const char* app_name, ver_t app_version);
#ifdef __cplusplus
}
#endif
#endif /* _h_kapp_loader_meta_*/
sra_sdk-2.1.7/interfaces/kdb/ 0000755 0012213 0011620 00000000000 11556622256 015530 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/kdb/column.h 0000644 0012213 0011620 00000021510 11476747550 017203 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kdb_column_
#define _h_kdb_column_
#ifndef _h_kdb_extern_
#include
#endif
#ifndef _h_kfs_directory_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KTable;
struct KDBManager;
/*--------------------------------------------------------------------------
* KChecksum
* describes blob checksum
*/
typedef uint8_t KChecksum;
enum
{
kcsNone,
kcsCRC32,
kcsMD5
};
/*--------------------------------------------------------------------------
* KColumn
* a collection of blobs indexed by oid
*/
typedef struct KColumn KColumn;
/* AddRef
* Release
* all objects are reference counted
* NULL references are ignored
*/
KDB_EXTERN rc_t CC KColumnAddRef ( const KColumn *self );
KDB_EXTERN rc_t CC KColumnRelease ( const KColumn *self );
/* CreateColumn
* VCreateColumn
* create a new or open an existing column
*
* "col" [ OUT ] - return parameter for newly opened column
*
* "cmode" [ IN ] - creation mode
*
* "checksum" [ IN ] - the type of checksum information to
* apply when writing blobs
*
* "pgsize" [ IN, DEFAULT ZERO ] - size of internal column "pages"
* the default value is indicated by 0 ( zero ).
* NB - CURRENTLY THE ONLY SUPPORTED PAGE SIZE IS 1 ( ONE ) BYTE.
*
* "path" [ IN ] - NUL terminated string in UTF-8 giving path to col
* where "." acts as a structure name separator, i.e. struct.member
*/
KDB_EXTERN rc_t CC KDBManagerCreateColumn ( struct KDBManager *self,
KColumn **col, KCreateMode cmode, KChecksum checksum,
size_t pgsize, const char *path, ... );
KDB_EXTERN rc_t CC KTableCreateColumn ( struct KTable *self,
KColumn **col, KCreateMode cmode, KChecksum checksum,
size_t pgsize, const char *path, ... );
KDB_EXTERN rc_t CC KDBManagerVCreateColumn ( struct KDBManager *self,
KColumn **col, KCreateMode cmode, KChecksum checksum,
size_t pgsize, const char *path, va_list args );
KDB_EXTERN rc_t CC KTableVCreateColumn ( struct KTable *self,
KColumn **col, KCreateMode cmode, KChecksum checksum,
size_t pgsize, const char *path, va_list args );
/* OpenColumnRead
* VOpenColumnRead
* open a column for read
*
* "col" [ OUT ] - return parameter for newly opened column
*
* "path" [ IN ] - NUL terminated string in UTF-8 giving path to col
* where "." acts as a structure name separator, i.e. struct.member
*/
KDB_EXTERN rc_t CC KDBManagerOpenColumnRead ( struct KDBManager const *self,
const KColumn **col, const char *path, ... );
KDB_EXTERN rc_t CC KTableOpenColumnRead ( struct KTable const *self,
const KColumn **col, const char *path, ... );
KDB_EXTERN rc_t CC KDBManagerVOpenColumnRead ( struct KDBManager const *self,
const KColumn **col, const char *path, va_list args );
KDB_EXTERN rc_t CC KTableVOpenColumnRead ( struct KTable const *self,
const KColumn **col, const char *path, va_list args );
/* OpenColumnUpdate
* VOpenColumnUpdate
* open a column for read/write
*
* "col" [ OUT ] - return parameter for newly opened column
*
* "path" [ IN ] - NUL terminated string in UTF-8 giving path to col
* where "." acts as a structure name separator, i.e. struct.member
*/
KDB_EXTERN rc_t CC KDBManagerOpenColumnUpdate ( struct KDBManager *self,
KColumn **col, const char *path, ... );
KDB_EXTERN rc_t CC KTableOpenColumnUpdate ( struct KTable *self,
KColumn **col, const char *path, ... );
KDB_EXTERN rc_t CC KDBManagerVOpenColumnUpdate ( struct KDBManager *self,
KColumn **col, const char *path, va_list args );
KDB_EXTERN rc_t CC KTableVOpenColumnUpdate ( struct KTable *self,
KColumn **col, const char *path, va_list args );
/* Locked
* returns true if locked
*/
KDB_EXTERN bool CC KColumnLocked ( const KColumn *self );
/* Version
* returns the format version
*/
KDB_EXTERN rc_t CC KColumnVersion ( const KColumn *self, uint32_t *version );
/* ByteOrder
* indicates whether original byte order is reversed
* under current architecture.
*
* the byte order of the column is established by
* the host architecture when created.
*
* "reversed" [ OUT ] - if true, the original byte
* order is reversed with regard to host native byte order.
*/
KDB_EXTERN rc_t CC KColumnByteOrder ( const KColumn *self, bool *reversed );
/* IdRange
* returns id range for column
*
* "first" [ OUT ] - first id in column
*
* "count" [ OUT ] - number of ids represented by this column
*/
KDB_EXTERN rc_t CC KColumnIdRange ( const KColumn *self, int64_t *first, uint64_t *count );
/* Reindex
* optimize indices
*/
KDB_EXTERN rc_t CC KColumnReindex ( KColumn *self );
/* CommitFreq
* SetCommitFreq
* manage frequency of commits
*/
KDB_EXTERN rc_t CC KColumnCommitFreq ( KColumn *self, uint32_t *freq );
KDB_EXTERN rc_t CC KColumnSetCommitFreq ( KColumn *self, uint32_t freq );
/* OpenManager
* duplicate reference to manager
* NB - returned reference must be released
*/
KDB_EXTERN rc_t CC KColumnOpenManagerRead ( const KColumn *self, struct KDBManager const **mgr );
KDB_EXTERN rc_t CC KColumnOpenManagerUpdate ( KColumn *self, struct KDBManager **mgr );
/* OpenParent
* duplicate reference to parent table
* NB - returned reference must be released
*/
KDB_EXTERN rc_t CC KColumnOpenParentRead ( const KColumn *self, struct KTable const **tbl );
KDB_EXTERN rc_t CC KColumnOpenParentUpdate ( KColumn *self, struct KTable **tbl );
/*--------------------------------------------------------------------------
* KColumnBlob
* one or more rows of column data
*/
typedef struct KColumnBlob KColumnBlob;
/* AddRef
* Release
* all objects are reference counted
* NULL references are ignored
*/
KDB_EXTERN rc_t CC KColumnBlobAddRef ( const KColumnBlob *self );
KDB_EXTERN rc_t CC KColumnBlobRelease ( const KColumnBlob *self );
/* CreateBlob
* creates a new, unassigned blob
*/
KDB_EXTERN rc_t CC KColumnCreateBlob ( KColumn *self, KColumnBlob **blob );
/* OpenBlobRead
* OpenBlobUpdate
* opens an existing blob containing row data for id
*/
KDB_EXTERN rc_t CC KColumnOpenBlobRead ( const KColumn *self, const KColumnBlob **blob, int64_t id );
KDB_EXTERN rc_t CC KColumnOpenBlobUpdate ( KColumn *self, KColumnBlob **blob, int64_t id );
/* Read
* read data from blob
*
* "offset" [ IN ] - starting offset into blob
*
* "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
*
* "num_read" [ OUT ] - number of bytes actually read
*
* "remaining" [ OUT, NULL OKAY ] - optional return parameter for
* the number of bytes remaining to be read. specifically,
* "offset" + "num_read" + "remaining" == sizeof blob
*/
KDB_EXTERN rc_t CC KColumnBlobRead ( const KColumnBlob *self,
size_t offset, void *buffer, size_t bsize,
size_t *num_read, size_t *remaining );
/* Append
* append data to open blob
*
* "buffer" [ IN ] and "size" [ IN ] - blob data
*/
KDB_EXTERN rc_t CC KColumnBlobAppend ( KColumnBlob *self, const void *buffer, size_t size );
/* Validate
* runs checksum validation on unmodified blob
*/
KDB_EXTERN rc_t CC KColumnBlobValidate ( const KColumnBlob *self );
/* IdRange
* AssignRange
* access id range for blob
*
* "first" [ OUT ] and "count" [ OUT ] - return parameters for IdRange
* "first" [ IN ] and "count" [ IN ] - range parameters for assign
*/
KDB_EXTERN rc_t CC KColumnBlobIdRange ( const KColumnBlob *self, int64_t *first, uint32_t *count );
KDB_EXTERN rc_t CC KColumnBlobAssignRange ( KColumnBlob *self, int64_t first, uint32_t count );
/* Commit
* commit changes to blob
* close to further updates
*/
KDB_EXTERN rc_t CC KColumnBlobCommit ( KColumnBlob *self );
#ifdef __cplusplus
}
#endif
#endif /* _h_kdb_column_ */
sra_sdk-2.1.7/interfaces/kdb/database.h 0000644 0012213 0011620 00000020330 11476747550 017451 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kdb_database_
#define _h_kdb_database_
#ifndef _h_kdb_extern_
#include
#endif
#ifndef _h_kfs_directory_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KDBManager;
/*--------------------------------------------------------------------------
* KDatabase
* opaque connection to a database within file system
*/
typedef struct KDatabase KDatabase;
/* AddRef
* Release
* all objects are reference counted
* NULL references are ignored
*/
KDB_EXTERN rc_t CC KDatabaseAddRef ( const KDatabase *self );
KDB_EXTERN rc_t CC KDatabaseRelease ( const KDatabase *self );
/* CreateDB
* VCreateDB
* create a new or open an existing database
*
* "db" [ OUT ] - return parameter for newly opened database
*
* "cmode" [ IN ] - creation mode
*
* "path" [ IN ] - NUL terminated string in
* wd-native character set giving path to database
*/
KDB_EXTERN rc_t CC KDBManagerCreateDB ( struct KDBManager *self,
KDatabase **db, KCreateMode cmode, const char *path, ... );
KDB_EXTERN rc_t CC KDatabaseCreateDB ( KDatabase *self,
KDatabase **db, KCreateMode cmode, const char *name, ... );
KDB_EXTERN rc_t CC KDBManagerVCreateDB ( struct KDBManager *self,
KDatabase **db, KCreateMode cmode, const char *path, va_list args );
KDB_EXTERN rc_t CC KDatabaseVCreateDB ( KDatabase *self,
KDatabase **db, KCreateMode cmode, const char *name, va_list args );
/* OpenDBRead
* VOpenDBRead
* open a database for read
*
* "db" [ OUT ] - return parameter for newly opened database
*
* "path" [ IN ] - NUL terminated string in
* wd-native character set giving path to database
*/
KDB_EXTERN rc_t CC KDBManagerOpenDBRead ( struct KDBManager const *self,
const KDatabase **db, const char *path, ... );
KDB_EXTERN rc_t CC KDatabaseOpenDBRead ( const KDatabase *self,
const KDatabase **db, const char *name, ... );
KDB_EXTERN rc_t CC KDBManagerVOpenDBRead ( struct KDBManager const *self,
const KDatabase **db, const char *path, va_list args );
KDB_EXTERN rc_t CC KDatabaseVOpenDBRead ( const KDatabase *self,
const KDatabase **db, const char *name, va_list args );
/* OpenDBUpdate
* VOpenDBUpdate
* open a database for read/write
*
* "db" [ OUT ] - return parameter for newly opened database
*
* "path" [ IN ] - NUL terminated string in
* wd-native character set giving path to database
*/
KDB_EXTERN rc_t CC KDBManagerOpenDBUpdate ( struct KDBManager *self,
KDatabase **db, const char *path, ... );
KDB_EXTERN rc_t CC KDatabaseOpenDBUpdate ( KDatabase *self,
KDatabase **db, const char *name, ... );
KDB_EXTERN rc_t CC KDBManagerVOpenDBUpdate ( struct KDBManager *self,
KDatabase **db, const char *path, va_list args );
KDB_EXTERN rc_t CC KDatabaseVOpenDBUpdate ( KDatabase *self,
KDatabase **db, const char *name, va_list args );
/* Locked
* returns true if locked
*/
KDB_EXTERN bool CC KDatabaseLocked ( const KDatabase *self );
/* Exists
* returns true if requested object exists
*
* "type" [ IN ] - a KDBPathType
* valid values are kptIndex and kptColumn
*
* "path" [ IN ] - NUL terminated path
*/
KDB_EXTERN bool CC KDatabaseExists ( const KDatabase *self, uint32_t type,
const char *name, ... );
KDB_EXTERN bool CC KDatabaseVExists ( const KDatabase *self, uint32_t type,
const char *name, va_list args );
/* Writable
* returns 0 if object is writable
* or a reason why if not
*
* "type" [ IN ] - a KDBPathType
* valid values are kptDatabase, kptTable and kptIndex
*
* "path" [ IN ] - NUL terminated path
*/
KDB_EXTERN rc_t CC KDatabaseWritable ( const KDatabase *self, uint32_t type,
const char *name, ... );
KDB_EXTERN rc_t CC KDatabaseVWritable ( const KDatabase *self, uint32_t type,
const char *name, va_list args );
/* Lock
* apply lock
*
* if object is already locked, the operation is idempotent
* and returns an rc state of rcLocked
*
* "type" [ IN ] - a KDBPathType
* valid values are kptDatabase, kptTable and kptIndex
*
* "path" [ IN ] - NUL terminated path
*/
KDB_EXTERN rc_t CC KDatabaseLock ( KDatabase *self, uint32_t type,
const char *name, ... );
KDB_EXTERN rc_t CC KDatabaseVLock ( KDatabase *self, uint32_t type,
const char *name, va_list args );
/* Unlock
* remove lock
*
* if object is already unlocked, the operation is idempotent
* and returns an rc state of rcUnlocked
*
* "type" [ IN ] - a KDBPathType
* valid values are kptDatabase, kptTable and kptIndex
*
* "path" [ IN ] - NUL terminated path
*/
KDB_EXTERN rc_t CC KDatabaseUnlock ( KDatabase *self, uint32_t type,
const char *name, ... );
KDB_EXTERN rc_t CC KDatabaseVUnlock ( KDatabase *self, uint32_t type,
const char *name, va_list args );
/* Rename
* renames a contained object
*
* "from" [ IN ] - NUL terminated string in UTF-8
* giving name of contained object
*
* "to" [ IN ] - NUL terminated string in UTF-8
* giving new name
*/
KDB_EXTERN rc_t CC KDatabaseRenameDB ( KDatabase *self, bool force, const char *from, const char *to );
KDB_EXTERN rc_t CC KDatabaseRenameTable ( KDatabase *self, bool force, const char *from, const char *to );
KDB_EXTERN rc_t CC KDatabaseRenameIndex ( KDatabase *self, bool force, const char *from, const char *to );
/* Alias
* create an alias to an existing contained object
*
* "obj" [ IN ] - NUL terminated string in UTF-8
* giving name of contained object
*
* "alias" [ IN ] - NUL terminated string in UTF-8
* giving aliased name
*/
KDB_EXTERN rc_t CC KDatabaseAliasDB ( KDatabase *self, const char *obj, const char *alias );
KDB_EXTERN rc_t CC KDatabaseAliasTable ( KDatabase *self, const char *obj, const char *alias );
KDB_EXTERN rc_t CC KDatabaseAliasIndex ( KDatabase *self, const char *obj, const char *alias );
/* Drop
* drop a contained object
*
* "name" [ IN ] - NUL terminated string in UTF-8 giving name of db
*/
KDB_EXTERN rc_t CC KDatabaseDropDB ( KDatabase *self, const char *name, ... );
KDB_EXTERN rc_t CC KDatabaseDropTable ( KDatabase *self, const char *name, ... );
KDB_EXTERN rc_t CC KDatabaseDropIndex ( KDatabase *self, const char *name, ... );
KDB_EXTERN rc_t CC KDatabaseVDropDB ( KDatabase *self, const char *name, va_list args );
KDB_EXTERN rc_t CC KDatabaseVDropTable ( KDatabase *self, const char *name, va_list args );
KDB_EXTERN rc_t CC KDatabaseVDropIndex ( KDatabase *self, const char *name, va_list args );
/* OpenManager
* duplicate reference to manager
* NB - returned reference must be released
*/
KDB_EXTERN rc_t CC KDatabaseOpenManagerRead ( const KDatabase *self, struct KDBManager const **mgr );
KDB_EXTERN rc_t CC KDatabaseOpenManagerUpdate ( KDatabase *self, struct KDBManager **mgr );
/* OpenParent
* duplicate reference to parent database
* NB - returned reference must be released
*/
KDB_EXTERN rc_t CC KDatabaseOpenParentRead ( const KDatabase *self, const KDatabase **par );
KDB_EXTERN rc_t CC KDatabaseOpenParentUpdate ( KDatabase *self, KDatabase **par );
#ifdef __cplusplus
}
#endif
#endif /* _h_kdb_database_ */
sra_sdk-2.1.7/interfaces/kdb/index.h 0000644 0012213 0011620 00000022120 11556621244 017001 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kdb_index_
#define _h_kdb_index_
#ifndef _h_kdb_extern_
#include
#endif
#ifndef _h_kfs_directory_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KTable;
struct PBSTNode;
struct KDatabase;
/*--------------------------------------------------------------------------
* KIdxType
* the type of index being dealt with
*/
typedef uint8_t KIdxType;
enum
{
/* version 1 */
kitText, /* text string => id */
kitU64, /* uint64 (like file offset) to row id */
kitProj = 128 /* reverse index flag, row id => key */
};
/*--------------------------------------------------------------------------
* KIndex
* an object capable of mapping an object to integer oid
*/
typedef struct KIndex KIndex;
/* Addref
* Release
* all objects are reference counted
* NULL references are ignored
*/
KDB_EXTERN rc_t CC KIndexAddRef ( const KIndex *self );
KDB_EXTERN rc_t CC KIndexRelease ( const KIndex *self );
/* CreateIndex
* VCreateIndex
* create a new or open an existing index
*
* "idx" [ OUT ] - return parameter for newly opened index
*
* "type" [ IN ] - type of index to create
*
* "cmode" [ IN ] - creation mode
*
* "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
*/
KDB_EXTERN rc_t CC KDatabaseCreateIndex ( struct KDatabase *self, KIndex **idx,
KIdxType type, KCreateMode cmode, const char *name, ... );
KDB_EXTERN rc_t CC KTableCreateIndex ( struct KTable *self, KIndex **idx,
KIdxType type, KCreateMode cmode, const char *name, ... );
KDB_EXTERN rc_t CC KDatabaseVCreateIndex ( struct KDatabase *self, KIndex **idx,
KIdxType type, KCreateMode cmode, const char *name, va_list args );
KDB_EXTERN rc_t CC KTableVCreateIndex ( struct KTable *self, KIndex **idx,
KIdxType type, KCreateMode cmode, const char *name, va_list args );
/* OpenIndexRead
* VOpenIndexRead
* open an index for read
*
* "idx" [ OUT ] - return parameter for newly opened index
*
* "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
*/
KDB_EXTERN rc_t CC KDatabaseOpenIndexRead ( struct KDatabase const *self,
const KIndex **idx, const char *name, ... );
KDB_EXTERN rc_t CC KTableOpenIndexRead ( struct KTable const *self,
const KIndex **idx, const char *name, ... );
KDB_EXTERN rc_t CC KDatabaseVOpenIndexRead ( struct KDatabase const *self,
const KIndex **idx, const char *name, va_list args );
KDB_EXTERN rc_t CC KTableVOpenIndexRead ( struct KTable const *self,
const KIndex **idx, const char *name, va_list args );
/* OpenIndexUpdate
* VOpenIndexUpdate
* open an index for read/write
*
* "idx" [ OUT ] - return parameter for newly opened index
*
* "name" [ IN ] - NUL terminated string in UTF-8 giving simple name of idx
*/
KDB_EXTERN rc_t CC KDatabaseOpenIndexUpdate ( struct KDatabase *self,
KIndex **idx, const char *name, ... );
KDB_EXTERN rc_t CC KTableOpenIndexUpdate ( struct KTable *self,
KIndex **idx, const char *name, ... );
KDB_EXTERN rc_t CC KDatabaseVOpenIndexUpdate ( struct KDatabase *self,
KIndex **idx, const char *name, va_list args );
KDB_EXTERN rc_t CC KTableVOpenIndexUpdate ( struct KTable *self,
KIndex **idx, const char *name, va_list args );
/* Locked
* returns true if locked
*/
KDB_EXTERN bool CC KIndexLocked ( const KIndex *self );
/* Version
* returns the format version
*/
KDB_EXTERN rc_t CC KIndexVersion ( const KIndex *self, uint32_t *version );
/* Type
* returns the type of index
*/
KDB_EXTERN rc_t CC KIndexType ( const KIndex *self, KIdxType *type );
/* Commit
* ensure any changes are committed to disk
*/
KDB_EXTERN rc_t CC KIndexCommit ( KIndex *self );
/* CheckConsistency
* run a consistency check on the open index
*
* "level" [ IN ] - a measure of rigor of the exercise:
* 0 is the lightest
* 1 will test all id mappings
* 2 will perform key->id retrievals
* 3 will perform id->key retrievals if a projection index exists
*
* "start_id" [ OUT, NULL OKAY ] - returns the first id in index
*
* "id_range" [ OUT, NULL OKAY ] - returns the range of ids from first to last
*
* "num_keys" [ OUT, NULL OKAY ] - returns the number of key entries
*
* "num_rows" [ OUT, NULL OKAY ] - returns the number of key->id mappings
*
* "num_holes" [ OUT, NULL OKAY ] - returns the number of holes in the mapped id range
*/
KDB_EXTERN rc_t CC KIndexConsistencyCheck ( const KIndex *self, uint32_t level,
int64_t *start_id, uint64_t *id_range, uint64_t *num_keys,
uint64_t *num_rows, uint64_t *num_holes );
/* Insert
* creates a mapping from key to id
* and potentially from id to key if supported
*
* "unique" [ IN ] - if true, key must be unique
*
* "key" [ IN ] - NUL terminated string for text
*
* "id" [ IN ] - id
*/
KDB_EXTERN rc_t CC KIndexInsertText ( KIndex *self, bool unique,
const char *key, int64_t id );
/* Delete
* deletes all mappings from key
*/
KDB_EXTERN rc_t CC KIndexDeleteText ( KIndex *self, const char *key );
/* Find
* finds a single mapping from key
*
* "key" [ IN ] - NUL terminated string to be found
*
* "start_id" [ OUT ] - starting id of found range
*
* "id_count [ OUT, NULL OKAY ] - the number of contiguous
* row ids in found range
*
* "custom_cmp" [ IN, NULL OKAY ] and "data" [ IN, OPAQUE ]
* optional comparison function for search
*/
KDB_EXTERN rc_t CC KIndexFindText ( const KIndex *self,
const char *key, int64_t *start_id, uint64_t *id_count,
int ( CC * custom_cmp ) ( const void *item,
struct PBSTNode const *n, void *data ),
void *data );
/* FindAll
* finds all mappings from key
*/
KDB_EXTERN rc_t CC KIndexFindAllText ( const KIndex *self, const char *key,
rc_t ( CC * f ) ( int64_t start_id, uint64_t id_count, void *data ),
void *data );
/* Project
* finds key(s) mapping to value/id if supported
*
* "id" [ IN ] - row id to be located
*
* "start_id [ OUT, NULL OKAY ] - the first id of found range
*
* "id_count [ OUT, NULL OKAY ] - the number of contiguous
* row ids in found range
*
* "key" [ OUT ] and "kmax" [ IN ] - return buffer
* for NUL terminated index text
*
* "actsize" [ OUT, NULL OKAY ] - returns key size in bytes,
* excluding NUL termination
*
* returns rcBuffer, rcInsufficient
* if kmax <= strlen ( key )
*/
KDB_EXTERN rc_t CC KIndexProjectText ( const KIndex *self,
int64_t id, int64_t *start_id, uint64_t *id_count,
char *key, size_t kmax, size_t *actsize );
/* ProjectAll
* finds key(s) mapping to value/id if supported
*/
KDB_EXTERN rc_t CC KIndexProjectAllText ( const KIndex *self, int64_t id,
rc_t ( CC * f ) ( int64_t start_id, uint64_t id_count, const char *key, void *data ),
void *data );
/* InsertU64
* creates a mapping from an (file) offset range to an id range
*
* "unique" [ IN ] - if true, key ranges cannot overlap
*
* "key" [ IN ] - offset (in file)
*
* "key_size" [ IN ] - size of chunk (in file)
*
* "start_id" [ IN ] - starting id
*
* "id_count" [ IN ] - number of ids in chunk
*/
KDB_EXTERN rc_t CC KIndexInsertU64 ( KIndex *self, bool unique,
uint64_t key, uint64_t key_size, int64_t start_id, uint64_t id_count );
/* DeleteU64
* deletes all mappings from key
*/
KDB_EXTERN rc_t CC KIndexDeleteU64 ( KIndex *self, uint64_t key );
/* FindU64
* finds a FIRST chunk by offset with in file
*/
KDB_EXTERN rc_t CC KIndexFindU64 ( const KIndex *self, uint64_t offset,
uint64_t *key, uint64_t *key_size, int64_t *start_id, uint64_t *id_count );
/* FindAllU64
* Iterate through all chunks with an offset and call f() for each range
*/
KDB_EXTERN rc_t CC KIndexFindAllU64 ( const KIndex *self, uint64_t offset,
rc_t ( CC * f ) ( uint64_t key, uint64_t key_size,
int64_t start_id, uint64_t id_count, void *data ),
void *data);
#ifdef __cplusplus
}
#endif
#endif /* _h_kdb_index_ */
sra_sdk-2.1.7/interfaces/kdb/kdb-priv.h 0000644 0012213 0011620 00000007760 11604623557 017430 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kdb_kdb_priv_
#define _h_kdb_kdb_priv_
#ifndef _h_kdb_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KDBManager;
struct KDatabase;
struct KTable;
struct KIndex;
struct KColumn;
struct KMetadata;
struct KDirectory;
/*--------------------------------------------------------------------------
* KDBManager
*/
/* ModDate
* return a modification timestamp for table
*/
KDB_EXTERN rc_t CC KDBManagerGetTableModDate ( struct KDBManager const *self,
KTime_t *mtime, const char *path, ... );
KDB_EXTERN rc_t CC KDBManagerVGetTableModDate ( struct KDBManager const *self,
KTime_t *mtime, const char *path, va_list args );
/*--------------------------------------------------------------------------
* KDatabase
*/
/* OpenDirectory
* access the directory in use
*/
KDB_EXTERN rc_t CC KDatabaseOpenDirectoryRead ( struct KDatabase const *self, struct KDirectory const **dir );
KDB_EXTERN rc_t CC KDatabaseOpenDirectoryUpdate ( struct KDatabase *self, struct KDirectory **dir );
/*--------------------------------------------------------------------------
* KTable
*/
/* OpenDirectory
* access the directory in use
*/
KDB_EXTERN rc_t CC KTableOpenDirectoryRead ( struct KTable const *self, struct KDirectory const **dir );
KDB_EXTERN rc_t CC KTableOpenDirectoryUpdate ( struct KTable *self, struct KDirectory **dir );
#define KTableGetDirectoryRead KTableOpenDirectoryRead
#define KTableGetDirectoryUpdate KTableOpenDirectoryUpdate
/*--------------------------------------------------------------------------
* KColumn
*/
/* OpenDirectory
* duplicate reference to the directory in use
* NB - returned reference must be released
*/
KDB_EXTERN rc_t CC KColumnOpenDirectoryRead ( struct KColumn const *self, struct KDirectory const **dir );
KDB_EXTERN rc_t CC KColumnOpenDirectoryUpdate ( struct KColumn *self, struct KDirectory **dir );
#define KColumnGetDirectoryRead KColumnOpenDirectoryRead
#define KColumnGetDirectoryUpdate KColumnOpenDirectoryUpdate
/*--------------------------------------------------------------------------
* KIndex
*/
/* MarkModified
* make the index think it has been modified, such that it may be committed
* useful when forcing conversion from an older version
*/
KDB_EXTERN rc_t CC KIndexMarkModified ( struct KIndex *self );
/* SetMaxId
* certain legacy versions of skey were built to know only the starting id
* of the NAME_FMT column, but were never given a maximum id. allow them
* to be corrected here.
*/
KDB_EXTERN void CC KIndexSetMaxRowId ( struct KIndex const *self, int64_t max_row_id );
#ifdef __cplusplus
}
#endif
#endif /* _h_kdb_kdb_priv_ */
sra_sdk-2.1.7/interfaces/kdb/manager.h 0000644 0012213 0011620 00000011752 11604623557 017320 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kdb_manager_
#define _h_kdb_manager_
#ifndef _h_kdb_extern_
#include
#endif
#ifndef _h_kfs_directory_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* KDBPathType
* extends KPathType from
*/
enum
{
/* must be handled carefully and can not go back to KDirectory
* as this value has a different meaning in KDirectory */
kptAny = 0,
kptDatabase = kptLastDefined,
kptTable,
kptIndex,
kptColumn
};
/*--------------------------------------------------------------------------
* KDBManager
* opaque handle to library
*/
typedef struct KDBManager KDBManager;
/* AddRef
* Release
* all objects are reference counted
* NULL references are ignored
*/
KDB_EXTERN rc_t CC KDBManagerAddRef ( const KDBManager *self );
KDB_EXTERN rc_t CC KDBManagerRelease ( const KDBManager *self );
/* MakeRead
* MakeUpdate
* create library handle for specific use
* NB - only one of the functions will be implemented
*
* "wd" [ IN, NULL OKAY ] - optional working directory for
* accessing the file system. mgr will attach its own reference.
*/
KDB_EXTERN rc_t CC KDBManagerMakeRead ( const KDBManager **mgr, const KDirectory *wd );
KDB_EXTERN rc_t CC KDBManagerMakeUpdate ( KDBManager **mgr, KDirectory *wd );
/* Version
* returns the library version
*/
KDB_EXTERN rc_t CC KDBManagerVersion ( const KDBManager *self, uint32_t *version );
/* Exists
* returns true if requested object exists
*
* "type" [ IN ] - a KDBPathType
*
* "path" [ IN ] - NUL terminated path
*/
KDB_EXTERN bool CC KDBManagerExists ( const KDBManager *self, uint32_t type,
const char *name, ... );
KDB_EXTERN bool CC KDBManagerVExists ( const KDBManager *self, uint32_t type,
const char *name, va_list args );
/* Writable
* returns 0 if object is writable
* or a reason why if not
*
* "path" [ IN ] - NUL terminated path
*/
KDB_EXTERN rc_t CC KDBManagerWritable ( const KDBManager *self,
const char *path, ... );
KDB_EXTERN rc_t CC KDBManagerVWritable ( const KDBManager *self,
const char *path, va_list args );
/* Lock
* apply lock
*
* if object is already locked, the operation is idempotent
* and returns an rc state of rcLocked
*
* "path" [ IN ] - NUL terminated path
*/
KDB_EXTERN rc_t CC KDBManagerLock ( KDBManager *self, const char *path, ... );
KDB_EXTERN rc_t CC KDBManagerVLock ( KDBManager *self, const char *path, va_list args );
/* Unlock
* remove lock
*
* if object is already unlocked, the operation is idempotent
* and returns an rc state of rcUnlocked
*
* "path" [ IN ] - NUL terminated path
*/
KDB_EXTERN rc_t CC KDBManagerUnlock ( KDBManager *self, const char *path, ... );
KDB_EXTERN rc_t CC KDBManagerVUnlock ( KDBManager *self, const char *path, va_list args );
/* Drop
* drop an object based on its path
*
* "path" [ IN ] - NUL terminated string in UTF-8 giving path to the kdb object
*/
KDB_EXTERN rc_t CC KDBManagerDrop ( KDBManager *self, uint32_t obj_type, const char *path, ... );
KDB_EXTERN rc_t CC KDBManagerVDrop ( KDBManager *self, uint32_t obj_type, const char *path, va_list args );
/* RunPeriodicTasks
* executes periodic tasks, such as cache flushing
*/
KDB_EXTERN rc_t CC KDBManagerRunPeriodicTasks ( const KDBManager *self );
/* PathType
* check the path type of an object/directory path.
* this is an extension of the KDirectoryPathType and will return
* the KDirectory values if a path type is not specifically a
* kdb object
*/
KDB_EXTERN int CC KDBManagerPathType ( const KDBManager * self, const char *path, ... );
KDB_EXTERN int CC KDBManagerVPathType ( const KDBManager * self, const char *path, va_list args );
#ifdef __cplusplus
}
#endif
#endif /* _h_kdb_manager_ */
sra_sdk-2.1.7/interfaces/kdb/meta.h 0000644 0012213 0011620 00000032240 11476747550 016636 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kdb_meta_
#define _h_kdb_meta_
#ifndef _h_kdb_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#include
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KTable;
struct KColumn;
struct KDatabase;
/*--------------------------------------------------------------------------
* KMetadata
* a versioned, hierarchical structure
*/
typedef struct KMetadata KMetadata;
/* AddRef
* Release
* all objects are reference counted
* NULL references are ignored
*/
KDB_EXTERN rc_t CC KMetadataAddRef ( const KMetadata *self );
KDB_EXTERN rc_t CC KMetadataRelease ( const KMetadata *self );
/* OpenMetadataRead
* opens metadata for read
*
* "meta" [ OUT ] - return parameter for metadata
*/
KDB_EXTERN rc_t CC KDatabaseOpenMetadataRead ( struct KDatabase const *self,
const KMetadata **meta );
KDB_EXTERN rc_t CC KTableOpenMetadataRead ( struct KTable const *self,
const KMetadata **meta );
KDB_EXTERN rc_t CC KColumnOpenMetadataRead ( struct KColumn const *self,
const KMetadata **meta );
/* OpenMetadataUpdate
* open metadata for read/write
*
* "meta" [ OUT ] - return parameter for metadata
*/
KDB_EXTERN rc_t CC KDatabaseOpenMetadataUpdate ( struct KDatabase *self,
KMetadata **meta );
KDB_EXTERN rc_t CC KTableOpenMetadataUpdate ( struct KTable *self,
KMetadata **meta );
KDB_EXTERN rc_t CC KColumnOpenMetadataUpdate ( struct KColumn *self,
KMetadata **meta );
/* Version
* returns the metadata format version
*/
KDB_EXTERN rc_t CC KMetadataVersion ( const KMetadata *self, uint32_t *version );
/* ByteOrder
* indicates whether original byte order is reversed
* under current architecture.
*
* the byte order of the column is established by
* the host architecture when created.
*
* "reversed" [ OUT ] - if true, the original byte
* order is reversed with regard to host native byte order.
*/
KDB_EXTERN rc_t CC KMetadataByteOrder ( const KMetadata *self, bool *reversed );
/* Revision
* returns current revision number
* where 0 ( zero ) means tip
*/
KDB_EXTERN rc_t CC KMetadataRevision ( const KMetadata *self, uint32_t *revision );
/* MaxRevision
* returns the maximum revision available
*/
KDB_EXTERN rc_t CC KMetadataMaxRevision ( const KMetadata *self, uint32_t *revision );
/* Commit
* ensure any changes are committed to disk
*/
KDB_EXTERN rc_t CC KMetadataCommit ( KMetadata *self );
/* Freeze
* freezes current metadata revision
* further modification will begin on a copy
*/
KDB_EXTERN rc_t CC KMetadataFreeze ( KMetadata *self );
/* OpenRevision
* opens a read-only indexed revision of metadata
*/
KDB_EXTERN rc_t CC KMetadataOpenRevision ( const KMetadata *self,
const KMetadata **meta, uint32_t revision );
/* GetSequence
* SetSequence
* NextSequence
* access a named sequence
*
* "seq" [ IN ] - NUL terminated sequence name
*
* "val" [ OUT ] - return parameter for sequence value
* "val" [ IN ] - new sequence value
*/
KDB_EXTERN rc_t CC KMetadataGetSequence ( const KMetadata *self,
const char *seq, int64_t *val );
KDB_EXTERN rc_t CC KMetadataSetSequence ( KMetadata *self,
const char *seq, int64_t val );
KDB_EXTERN rc_t CC KMetadataNextSequence ( KMetadata *self,
const char *seq, int64_t *val );
/*--------------------------------------------------------------------------
* KMDataNode
* a node with an optional value,
* optional attributes, and optional children
*
* nodes are identified by path, relative to a starting node,
* where "/" serves as a path separator.
*/
typedef struct KMDataNode KMDataNode;
/* AddRef
* Release
* all objects are reference counted
* NULL references are ignored
*/
KDB_EXTERN rc_t CC KMDataNodeAddRef ( const KMDataNode *self );
KDB_EXTERN rc_t CC KMDataNodeRelease ( const KMDataNode *self );
/* OpenNodeRead
* VOpenNodeRead
* opens a metadata node
*
* "node" [ OUT ] - return parameter for indicated metadata node
*
* "path" [ IN, NULL OKAY ] - optional path for specifying named
* node within metadata hierarchy. paths will be interpreted as
* if they were file system paths, using '/' as separator. the
* special values NULL and "" are interpreted as "."
*/
KDB_EXTERN rc_t CC KMetadataOpenNodeRead ( const KMetadata *self,
const KMDataNode **node, const char *path, ... );
KDB_EXTERN rc_t CC KMDataNodeOpenNodeRead ( const KMDataNode *self,
const KMDataNode **node, const char *path, ... );
KDB_EXTERN rc_t CC KMetadataVOpenNodeRead ( const KMetadata *self,
const KMDataNode **node, const char *path, va_list args );
KDB_EXTERN rc_t CC KMDataNodeVOpenNodeRead ( const KMDataNode *self,
const KMDataNode **node, const char *path, va_list args );
/* OpenNodeUpdate
* VOpenNodeUpdate
* opens a metadata node
*
* "node" [ OUT ] - return parameter for indicated metadata node
*
* "path" [ IN, NULL OKAY ] - optional path for specifying named
* node within metadata hierarchy. paths will be interpreted as
* if they were file system paths, using '/' as separator. the
* special values NULL and "" are interpreted as "."
*/
KDB_EXTERN rc_t CC KMetadataOpenNodeUpdate ( KMetadata *self,
KMDataNode **node, const char *path, ... );
KDB_EXTERN rc_t CC KMDataNodeOpenNodeUpdate ( KMDataNode *self,
KMDataNode **node, const char *path, ... );
KDB_EXTERN rc_t CC KMetadataVOpenNodeUpdate ( KMetadata *self,
KMDataNode **node, const char *path, va_list args );
KDB_EXTERN rc_t CC KMDataNodeVOpenNodeUpdate ( KMDataNode *self,
KMDataNode **node, const char *path, va_list args );
/* ByteOrder
* indicates whether original byte order is reversed
* under current architecture.
*
* the byte order of the column is established by
* the host architecture when created.
*
* "reversed" [ OUT ] - if true, the original byte
* order is reversed with regard to host native byte order.
*/
KDB_EXTERN rc_t CC KMDataNodeByteOrder ( const KMDataNode *self, bool *reversed );
/* Read
* read a node value
*
* "offset" [ IN ] - initial offset into metadata
*
* "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
*
* "num_read" [ OUT ] - number of bytes actually read
*
* "remaining" [ OUT, NULL OKAY ] - optional return parameter for
* the number of bytes remaining to be read.
* specifically, "offset" + "num_read" + "remaining" == sizeof node data
*/
KDB_EXTERN rc_t CC KMDataNodeRead ( const KMDataNode *self,
size_t offset, void *buffer, size_t bsize,
size_t *num_read, size_t *remaining );
/* Write
* write a node value or attribute
* overwrites anything already there
*
* "buffer" [ IN ] and "size" [ IN ] - new value data
*/
KDB_EXTERN rc_t CC KMDataNodeWrite ( KMDataNode *self, const void *buffer, size_t size );
/* Append
* append data to value
*
* "buffer" [ IN ] and "size" [ IN ] - value data to be appended
*/
KDB_EXTERN rc_t CC KMDataNodeAppend ( KMDataNode *self, const void *buffer, size_t size );
/* Read ( formatted )
* reads as integer or float value in native byte order
*
* "bXX" [ OUT ] - return parameter for numeric value
*/
KDB_EXTERN rc_t CC KMDataNodeReadB8 ( const KMDataNode *self, void *b8 );
KDB_EXTERN rc_t CC KMDataNodeReadB16 ( const KMDataNode *self, void *b16 );
KDB_EXTERN rc_t CC KMDataNodeReadB32 ( const KMDataNode *self, void *b32 );
KDB_EXTERN rc_t CC KMDataNodeReadB64 ( const KMDataNode *self, void *b64 );
KDB_EXTERN rc_t CC KMDataNodeReadB128 ( const KMDataNode *self, void *b128 );
/* ReadAs ( formatted )
* reads as integer or float value in native byte order
* casts smaller-sized values to desired size, e.g.
* uint32_t to uint64_t
*
* "i" [ OUT ] - return parameter for signed integer
* "u" [ OUT ] - return parameter for unsigned integer
* "f" [ OUT ] - return parameter for double float
*/
KDB_EXTERN rc_t CC KMDataNodeReadAsI16 ( const KMDataNode *self, int16_t *i );
KDB_EXTERN rc_t CC KMDataNodeReadAsU16 ( const KMDataNode *self, uint16_t *u );
KDB_EXTERN rc_t CC KMDataNodeReadAsI32 ( const KMDataNode *self, int32_t *i );
KDB_EXTERN rc_t CC KMDataNodeReadAsU32 ( const KMDataNode *self, uint32_t *u );
KDB_EXTERN rc_t CC KMDataNodeReadAsI64 ( const KMDataNode *self, int64_t *i );
KDB_EXTERN rc_t CC KMDataNodeReadAsU64 ( const KMDataNode *self, uint64_t *u );
KDB_EXTERN rc_t CC KMDataNodeReadAsF64 ( const KMDataNode *self, double *f );
/* Read ( formatted )
* reads as C-string
*
* "buffer" [ OUT ] and "bsize" [ IN ] - output buffer for
* NUL terminated string.
*
* "size" [ OUT ] - return parameter giving size of string
* not including NUL byte. the size is set both upon success
* and insufficient buffer space error.
*/
KDB_EXTERN rc_t CC KMDataNodeReadCString ( const KMDataNode *self,
char *buffer, size_t bsize, size_t *size );
/* Write ( formatted )
* writes integer or float value in metadata byte order
*
* "bXX" [ IN ] - numeric value
*/
KDB_EXTERN rc_t CC KMDataNodeWriteB8 ( KMDataNode *self, const void *b8 );
KDB_EXTERN rc_t CC KMDataNodeWriteB16 ( KMDataNode *self, const void *b16 );
KDB_EXTERN rc_t CC KMDataNodeWriteB32 ( KMDataNode *self, const void *b32 );
KDB_EXTERN rc_t CC KMDataNodeWriteB64 ( KMDataNode *self, const void *b64 );
KDB_EXTERN rc_t CC KMDataNodeWriteB128 ( KMDataNode *self, const void *b128 );
/* Write ( formatted )
* writes string
*
* "str" [ IN ] - NUL terminated string.
*/
KDB_EXTERN rc_t CC KMDataNodeWriteCString ( KMDataNode *self, const char *str );
/* ReadAttr
* reads as NUL-terminated string
*
* "name" [ IN ] - NUL terminated attribute name
*
* "buffer" [ OUT ] and "bsize" - return parameter for attribute value
*
* "size" [ OUT ] - return parameter giving size of string
* not including NUL byte. the size is set both upon success
* and insufficient buffer space error.
*/
KDB_EXTERN rc_t CC KMDataNodeReadAttr ( const KMDataNode *self, const char *name,
char *buffer, size_t bsize, size_t *size );
/* WriteAttr
* writes NUL-terminated string
*
* "name" [ IN ] - NUL terminated attribute name
*
* "value" [ IN ] - NUL terminated attribute value
*/
KDB_EXTERN rc_t CC KMDataNodeWriteAttr ( KMDataNode *self,
const char *name, const char *value );
/* ReadAttrAs ( formatted )
* reads as integer or float value in native byte order
* casts smaller-sized values to desired size, e.g.
* uint32_t to uint64_t
*
* "i" [ OUT ] - return parameter for signed integer
* "u" [ OUT ] - return parameter for unsigned integer
* "f" [ OUT ] - return parameter for double float
*/
KDB_EXTERN rc_t CC KMDataNodeReadAttrAsI16 ( const KMDataNode *self, const char *attr, int16_t *i );
KDB_EXTERN rc_t CC KMDataNodeReadAttrAsU16 ( const KMDataNode *self, const char *attr, uint16_t *u );
KDB_EXTERN rc_t CC KMDataNodeReadAttrAsI32 ( const KMDataNode *self, const char *attr, int32_t *i );
KDB_EXTERN rc_t CC KMDataNodeReadAttrAsU32 ( const KMDataNode *self, const char *attr, uint32_t *u );
KDB_EXTERN rc_t CC KMDataNodeReadAttrAsI64 ( const KMDataNode *self, const char *attr, int64_t *i );
KDB_EXTERN rc_t CC KMDataNodeReadAttrAsU64 ( const KMDataNode *self, const char *attr, uint64_t *u );
KDB_EXTERN rc_t CC KMDataNodeReadAttrAsF64 ( const KMDataNode *self, const char *attr, double *f );
/* Drop
* VDrop
* drop some or all node content
*/
KDB_EXTERN rc_t CC KMDataNodeDropAll ( KMDataNode *self );
KDB_EXTERN rc_t CC KMDataNodeDropAttr ( KMDataNode *self, const char *attr );
KDB_EXTERN rc_t CC KMDataNodeDropChild ( KMDataNode *self, const char *path, ... );
KDB_EXTERN rc_t CC KMDataNodeVDropChild ( KMDataNode *self, const char *path, va_list args );
/* Rename
* renames a contained object
*
* "from" [ IN ] - NUL terminated string in UTF-8
* giving simple name of existing attr
*
* "to" [ IN ] - NUL terminated string in UTF-8
* giving new simple attr name
*/
KDB_EXTERN rc_t CC KMDataNodeRenameAttr ( KMDataNode *self, const char *from, const char *to );
KDB_EXTERN rc_t CC KMDataNodeRenameChild ( KMDataNode *self, const char *from, const char *to );
#ifdef __cplusplus
}
#endif
#endif /* _h_kdb_meta_ */
sra_sdk-2.1.7/interfaces/kdb/meta.hpp 0000644 0012213 0011620 00000040402 11520072536 017156 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _hpp_kdb_meta_
#define _hpp_kdb_meta_
#ifndef _h_kdb_meta_
#include
#endif
/*--------------------------------------------------------------------------
* KMetadata
* a versioned, hierarchical structure
*/
struct KMetadata
{
/* AddRef
* Release
* all objects are reference counted
* NULL references are ignored
*/
inline rc_t AddRef () const throw()
{ return KMetadataAddRef ( this ); }
inline rc_t Release () const throw()
{ return KMetadataRelease ( this ); }
/* OpenNodeRead
* opens a metadata node
*
* "node" [ OUT ] - return parameter for indicated metadata node
*
* "path" [ IN, NULL OKAY ] - optional path for specifying named
* node within metadata hierarchy. paths will be interpreted as
* if they were file system paths, using '/' as separator. the
* special values NULL and "" are interpreted as "."
*/
inline rc_t OpenNodeRead ( const KMDataNode **node,
const char *path, ... ) const throw()
{
va_list args;
va_start ( args, path );
rc_t rc = KMetadataVOpenNodeRead ( this, node, path, args );
va_end ( args );
return rc;
}
inline rc_t OpenNodeRead ( const KMDataNode **node,
const char *path, va_list args ) const throw()
{ return KMetadataVOpenNodeRead ( this, node, path, args ); }
/* OpenNodeUpdate
* opens a metadata node
*
* "node" [ OUT ] - return parameter for indicated metadata node
*
* "path" [ IN, NULL OKAY ] - optional path for specifying named
* node within metadata hierarchy. paths will be interpreted as
* if they were file system paths, using '/' as separator. the
* special values NULL and "" are interpreted as "."
*/
inline rc_t OpenNodeUpdate ( KMDataNode **node,
const char *path, ... ) throw()
{
va_list args;
va_start ( args, path );
rc_t rc = KMetadataVOpenNodeUpdate ( this, node, path, args );
va_end ( args );
return rc;
}
inline rc_t OpenNodeUpdate ( KMDataNode **node,
const char *path, va_list args ) throw()
{ return KMetadataVOpenNodeUpdate ( this, node, path, args ); }
/* Version
* returns the metadata format version
*/
inline rc_t Version ( uint32_t *version ) const throw()
{ return KMetadataVersion ( this, version ); }
/* ByteOrder
* indicates whether original byte order is reversed
* under current architecture.
*
* the byte order of the column is established by
* the host architecture when created.
*
* "reversed" [ OUT ] - if true, the original byte
* order is reversed with regard to host native byte order.
*/
inline rc_t ByteOrder ( bool *reversed ) const throw()
{ return KMetadataByteOrder ( this, reversed ); }
/* Revision
* returns current revision number
* where 0 ( zero ) means tip
*/
inline rc_t Revision ( uint32_t *revision ) const throw()
{ return KMetadataRevision ( this, revision ); }
/* MaxRevision
* returns the maximum revision available
*/
inline rc_t MaxRevision ( uint32_t *revision ) const throw()
{ return KMetadataMaxRevision ( this, revision ); }
/* Commit
* ensure any changes are committed to disk
*/
inline rc_t Commit () throw()
{ return KMetadataCommit ( this ); }
/* Freeze
* freezes current metadata revision
* further modification will begin on a copy
*/
inline rc_t Freeze () throw()
{ return KMetadataFreeze ( this ); }
/* OpenRevision
* opens a read-only indexed revision of metadata
*/
inline rc_t OpenRevision ( const KMetadata **meta, uint32_t revision ) const throw()
{ return KMetadataOpenRevision ( this, meta, revision ); }
/* GetSequence
* SetSequence
* NextSequence
* access a named sequence
*
* "seq" [ IN ] - NUL terminated sequence name
*
* "val" [ OUT ] - return parameter for sequence value
* "val" [ IN ] - new sequence value
*/
inline rc_t GetSequence ( const char *seq, int64_t *val ) const throw()
{ return KMetadataGetSequence ( this, seq, val ); }
inline rc_t SetSequence ( const char *seq, int64_t val ) throw()
{ return KMetadataSetSequence ( this, seq, val ); }
inline rc_t NextSequence ( const char *seq, int64_t *val ) throw()
{ return KMetadataNextSequence ( this, seq, val ); }
private:
KMetadata ();
~ KMetadata ();
KMetadata ( const KMetadata& );
KMetadata &operator = ( const KMetadata& );
};
/*--------------------------------------------------------------------------
* KMDataNode
* a node with an optional value,
* optional attributes, and optional children
*
* nodes are identified by path, relative to a starting node,
* where "/" serves as a path separator.
*/
struct KMDataNode
{
/* AddRef
* Release
* ignores NULL references
*/
inline rc_t AddRef () const throw()
{ return KMDataNodeAddRef ( this ); }
inline rc_t Release () const throw()
{ return KMDataNodeRelease ( this ); }
/* OpenNodeRead
* VOpenNodeRead
* opens a metadata node
*
* "node" [ OUT ] - return parameter for indicated metadata node
*
* "path" [ IN, NULL OKAY ] - optional path for specifying named
* node within metadata hierarchy. paths will be interpreted as
* if they were file system paths, using '/' as separator. the
* special values NULL and "" are interpreted as "."
*/
inline rc_t OpenNodeRead ( const KMDataNode **node,
const char *path, ... ) const throw()
{
va_list args;
va_start ( args, path );
rc_t rc = KMDataNodeVOpenNodeRead ( this, node, path, args );
va_end ( args );
return rc;
}
inline rc_t OpenNodeRead ( const KMDataNode **node,
const char *path, va_list args ) const throw()
{ return KMDataNodeVOpenNodeRead ( this, node, path, args ); }
/* OpenNodeUpdate
* VOpenNodeUpdate
* opens a metadata node
*
* "node" [ OUT ] - return parameter for indicated metadata node
*
* "path" [ IN, NULL OKAY ] - optional path for specifying named
* node within metadata hierarchy. paths will be interpreted as
* if they were file system paths, using '/' as separator. the
* special values NULL and "" are interpreted as "."
*/
inline rc_t OpenNodeUpdate ( KMDataNode **node,
const char *path, ... ) throw()
{
va_list args;
va_start ( args, path );
rc_t rc = KMDataNodeVOpenNodeUpdate ( this, node, path, args );
va_end ( args );
return rc;
}
inline rc_t OpenNodeUpdate ( KMDataNode **node,
const char *path, va_list args ) throw()
{ return KMDataNodeVOpenNodeUpdate ( this, node, path, args ); }
/* ByteOrder
* indicates whether original byte order is reversed
* under current architecture.
*
* the byte order of the column is established by
* the host architecture when created.
*
* "reversed" [ OUT ] - if true, the original byte
* order is reversed with regard to host native byte order.
*/
inline rc_t ByteOrder ( bool *reversed ) const throw()
{ return KMDataNodeByteOrder ( this, reversed ); }
/* Write
* write a node value or attribute
* overwrites anything already there
*
* "buffer" [ IN ] and "size" [ IN ] - new value data
*/
inline rc_t Write ( const void *buffer, size_t size ) throw()
{ return KMDataNodeWrite ( this, buffer, size ); }
/* Append
* append data to value
*
* "buffer" [ IN ] and "size" [ IN ] - value data to be appended
*/
inline rc_t Append ( const void *buffer, size_t size ) throw()
{ return KMDataNodeAppend ( this, buffer, size ); }
/* Read ( formatted )
* reads as integer or float value in native byte order
*
* "bXX" [ OUT ] - return parameter for numeric value
*/
inline rc_t ReadB8 ( void *b8 ) const throw()
{ return KMDataNodeReadB8 ( this, b8 ); }
inline rc_t ReadB16 ( void *b16 ) const throw()
{ return KMDataNodeReadB16 ( this, b16 ); }
inline rc_t ReadB32 ( void *b32 ) const throw()
{ return KMDataNodeReadB32 ( this, b32 ); }
inline rc_t ReadB64 ( void *b64 ) const throw()
{ return KMDataNodeReadB64 ( this, b64 ); }
inline rc_t ReadB128 ( void *b128 ) const throw()
{ return KMDataNodeReadB128 ( this, b128 ); }
/* Read
* read a node value
*
* "offset" [ IN ] - initial offset into metadata
*
* "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
*
* "num_read" [ OUT ] - number of bytes actually read
*
* "remaining" [ OUT, NULL OKAY ] - optional return parameter for
* the number of bytes remaining to be read.
* specifically, "offset" + "num_read" + "remaining" == sizeof node data
*/
inline rc_t Read ( size_t offset, void *buffer, size_t bsize,
size_t *num_read, size_t *remaining ) const throw()
{ return KMDataNodeRead ( this, offset, buffer, bsize, num_read, remaining ); }
/* Read ( formatted )
* reads as integer or float value in native byte order
* casts smaller-sized values to desired size, e.g.
* uint32_t to uint64_t
*
* "i" [ OUT ] - return parameter for signed integer
* "u" [ OUT ] - return parameter for unsigned integer
* "f" [ OUT ] - return parameter for double float
*/
inline rc_t Read ( int16_t *value ) const throw()
{ return KMDataNodeReadAsI16 ( this, value ); }
inline rc_t Read ( uint16_t *value ) const throw()
{ return KMDataNodeReadAsU16 ( this, value ); }
inline rc_t Read ( int32_t *value ) const throw()
{ return KMDataNodeReadAsI32 ( this, value ); }
inline rc_t Read ( uint32_t *value ) const throw()
{ return KMDataNodeReadAsU32 ( this, value ); }
inline rc_t Read ( int64_t *value ) const throw()
{ return KMDataNodeReadAsI64 ( this, value ); }
inline rc_t Read ( uint64_t *value ) const throw()
{ return KMDataNodeReadAsU64 ( this, value ); }
inline rc_t Read ( double *value ) const throw()
{ return KMDataNodeReadAsF64 ( this, value ); }
/* Read ( formatted )
* reads as C-string
*
* "buffer" [ OUT ] and "bsize" [ IN ] - output buffer for
* NUL terminated string.
*
* "size" [ OUT ] - return parameter giving size of string
* not including NUL byte. the size is set both upon success
* and insufficient buffer space error.
*/
inline rc_t Read ( char *buffer, size_t bsize, size_t *size ) const throw()
{ return KMDataNodeReadCString ( this, buffer, bsize, size ); }
/* Write ( formatted )
* writes integer or float value in metadata byte order
*
* "bXX" [ IN ] - numeric value
*/
inline rc_t WriteB8 ( const void *b8 ) throw()
{ return KMDataNodeWriteB8 ( this, b8 ); }
inline rc_t WriteB16 ( const void *b16 ) throw()
{ return KMDataNodeWriteB16 ( this, b16 ); }
inline rc_t WriteB32 ( const void *b32 ) throw()
{ return KMDataNodeWriteB32 ( this, b32 ); }
inline rc_t WriteB64 ( const void *b64 ) throw()
{ return KMDataNodeWriteB64 ( this, b64 ); }
inline rc_t WriteB128 ( const void *b128 ) throw()
{ return KMDataNodeWriteB128 ( this, b128 ); }
/* Write ( formatted )
* writes string
*
* "str" [ IN ] - NUL terminated string.
*/
inline rc_t WriteCString ( const char *str ) throw()
{ return KMDataNodeWriteCString ( this, str ); }
/* ReadAttr
* reads as NUL-terminated string
*
* "name" [ IN ] - NUL terminated attribute name
*
* "buffer" [ OUT ] and "bsize" - return parameter for attribute value
*
* "size" [ OUT ] - return parameter giving size of string
* not including NUL byte. the size is set both upon success
* and insufficient buffer space error.
*/
inline rc_t ReadAttr ( const char *name, char *buffer,
size_t bsize, size_t *size ) const throw()
{ return KMDataNodeReadAttr ( this, name, buffer, bsize, size ); }
/* WriteAttr
* writes NUL-terminated string
*
* "name" [ IN ] - NUL terminated attribute name
*
* "value" [ IN ] - NUL terminated attribute value
*/
inline rc_t WriteAttr ( const char *name, const char *value ) throw()
{ return KMDataNodeWriteAttr ( this, name, value ); }
/* ReadAttrAs ( formatted )
* reads as integer or float value in native byte order
* casts smaller-sized values to desired size, e.g.
* uint32_t to uint64_t
*
* "i" [ OUT ] - return parameter for signed integer
* "u" [ OUT ] - return parameter for unsigned integer
* "f" [ OUT ] - return parameter for double float
*/
inline rc_t ReadAttrAsI16 ( const char *attr, int16_t *i ) const throw()
{ return KMDataNodeReadAttrAsI16 ( this, attr, i ); }
inline rc_t ReadAttrAsU16 ( const char *attr, uint16_t *i ) const throw()
{ return KMDataNodeReadAttrAsU16 ( this, attr, i ); }
inline rc_t ReadAttrAsI32 ( const char *attr, int32_t *i ) const throw()
{ return KMDataNodeReadAttrAsI32 ( this, attr, i ); }
inline rc_t ReadAttrAsU32 ( const char *attr, uint32_t *i ) const throw()
{ return KMDataNodeReadAttrAsU32 ( this, attr, i ); }
inline rc_t ReadAttrAsI64 ( const char *attr, int64_t *i ) const throw()
{ return KMDataNodeReadAttrAsI64 ( this, attr, i ); }
inline rc_t ReadAttrAsU64 ( const char *attr, uint64_t *i ) const throw()
{ return KMDataNodeReadAttrAsU64 ( this, attr, i ); }
inline rc_t ReadAttrAsF64 ( const char *attr, double *f ) const throw()
{ return KMDataNodeReadAttrAsF64 ( this, attr, f ); }
/* Drop
* drop some or all node content
*/
inline rc_t DropAll () throw()
{ return KMDataNodeDropAll ( this ); }
inline rc_t DropAttr ( const char *attr ) throw()
{ return KMDataNodeDropAttr ( this, attr ); }
inline rc_t DropChild ( const char *path, ... ) throw()
{
va_list args;
va_start ( args, path );
rc_t rc = KMDataNodeVDropChild ( this, path, args );
va_end ( args );
return rc;
}
inline rc_t DropChild ( const char *path, va_list args ) throw()
{ return KMDataNodeVDropChild ( this, path, args ); }
/* Rename
* renames a contained object
*
* "from" [ IN ] - NUL terminated string in UTF-8
* giving simple name of existing attr
*
* "to" [ IN ] - NUL terminated string in UTF-8
* giving new simple attr name
*/
inline rc_t RenameAttr ( const char *from, const char *to ) throw()
{ return KMDataNodeRenameAttr ( this, from, to ); }
inline rc_t RenameChild ( const char *from, const char *to ) throw()
{ return KMDataNodeRenameChild ( this, from, to ); }
private:
KMDataNode ();
~ KMDataNode ();
KMDataNode ( const KMDataNode& );
KMDataNode &operator = ( const KMDataNode& );
};
#endif // _hpp_kdb_meta_
sra_sdk-2.1.7/interfaces/kdb/namelist.h 0000644 0012213 0011620 00000004771 11476747550 017534 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kdb_namelist_
#define _h_kdb_namelist_
#ifndef _h_kdb_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KTable;
struct KDatabase;
struct KMDataNode;
struct KNamelist;
/*--------------------------------------------------------------------------
* KNamelist
*/
/* List
* create database listings
*/
KDB_EXTERN rc_t CC KDatabaseListDB ( struct KDatabase const *self, struct KNamelist **names );
KDB_EXTERN rc_t CC KDatabaseListTbl ( struct KDatabase const *self, struct KNamelist **names );
KDB_EXTERN rc_t CC KDatabaseListIdx ( struct KDatabase const *self, struct KNamelist **names );
/* List
* create table listings
*/
KDB_EXTERN rc_t CC KTableListCol ( struct KTable const *self, struct KNamelist **names );
KDB_EXTERN rc_t CC KTableListIdx ( struct KTable const *self, struct KNamelist **names );
/* List
* create metadata node listings
*/
KDB_EXTERN rc_t CC KMDataNodeListAttr ( struct KMDataNode const *self, struct KNamelist **names );
KDB_EXTERN rc_t CC KMDataNodeListChild ( struct KMDataNode const *self, struct KNamelist **names );
#ifdef __cplusplus
}
#endif
#endif /* _h_kdb_namelist_ */
sra_sdk-2.1.7/interfaces/kdb/table.h 0000644 0012213 0011620 00000017547 11520072536 016775 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kdb_table_
#define _h_kdb_table_
#ifndef _h_kdb_extern_
#include
#endif
#ifndef _h_kfs_directory_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KDatabase;
struct KDBManager;
/*--------------------------------------------------------------------------
* KTable
* a collection of columns indexed by row id, metadata, indices
*/
typedef struct KTable KTable;
/* AddRef
* Release
* all objects are reference counted
* NULL references are ignored
*/
KDB_EXTERN rc_t CC KTableAddRef ( const KTable *self );
KDB_EXTERN rc_t CC KTableRelease ( const KTable *self );
/* CreateTable
* VCreateTable
* create a new or open an existing table
*
* "tbl" [ OUT ] - return parameter for newly opened table
*
* "cmode" [ IN ] - creation mode
*
* "path" [ IN ] - NUL terminated string in
* wd-native character set giving path to table
*/
KDB_EXTERN rc_t CC KDBManagerCreateTable ( struct KDBManager *self,
KTable **tbl, KCreateMode cmode, const char *path, ... );
KDB_EXTERN rc_t CC KDatabaseCreateTable ( struct KDatabase *self,
KTable **tbl, KCreateMode cmode, const char *name, ... );
KDB_EXTERN rc_t CC KDBManagerVCreateTable ( struct KDBManager *self,
KTable **tbl, KCreateMode cmode, const char *path, va_list args );
KDB_EXTERN rc_t CC KDatabaseVCreateTable ( struct KDatabase *self,
KTable **tbl, KCreateMode cmode, const char *name, va_list args );
/* OpenTableRead
* VOpenTableRead
* open a table for read
*
* "tbl" [ OUT ] - return parameter for newly opened table
*
* "path" [ IN ] - NUL terminated string in
* wd-native character set giving path to table
*/
KDB_EXTERN rc_t CC KDBManagerOpenTableRead ( struct KDBManager const *self,
const KTable **tbl, const char *path, ... );
KDB_EXTERN rc_t CC KDatabaseOpenTableRead ( struct KDatabase const *self,
const KTable **tbl, const char *name, ... );
KDB_EXTERN rc_t CC KDBManagerVOpenTableRead ( struct KDBManager const *self,
const KTable **tbl, const char *path, va_list args );
KDB_EXTERN rc_t CC KDatabaseVOpenTableRead ( struct KDatabase const *self,
const KTable **tbl, const char *name, va_list args );
/* OpenTableUpdate
* VOpenTableUpdate
* open a table for read/write
*
* "tbl" [ OUT ] - return parameter for newly opened table
*
* "name" [ IN ] - NUL terminated string in UTF-8 giving name of table
*/
KDB_EXTERN rc_t CC KDBManagerOpenTableUpdate ( struct KDBManager *self,
KTable **tbl, const char *path, ... );
KDB_EXTERN rc_t CC KDatabaseOpenTableUpdate ( struct KDatabase *self,
KTable **tbl, const char *name, ... );
KDB_EXTERN rc_t CC KDBManagerVOpenTableUpdate ( struct KDBManager *self,
KTable **tbl, const char *path, va_list args );
KDB_EXTERN rc_t CC KDatabaseVOpenTableUpdate ( struct KDatabase *self,
KTable **tbl, const char *name, va_list args );
/* Locked
* returns true if table is locked
*/
KDB_EXTERN bool CC KTableLocked ( const KTable *self );
/* Exists
* returns true if requested object exists
*
* "type" [ IN ] - a KDBPathType
* valid values are kptIndex and kptColumn
*
* "path" [ IN ] - NUL terminated path
*/
KDB_EXTERN bool CC KTableExists ( const KTable *self, uint32_t type,
const char *name, ... );
KDB_EXTERN bool CC KTableVExists ( const KTable *self, uint32_t type,
const char *name, va_list args );
/* Writable
* returns 0 if object is writable
* or a reason why if not
*
* "type" [ IN ] - a KDBPathType
* valid values are kptIndex and kptColumn
*
* "path" [ IN ] - NUL terminated path
*/
KDB_EXTERN rc_t CC KTableWritable ( const KTable *self, uint32_t type,
const char *name, ... );
KDB_EXTERN rc_t CC KTableVWritable ( const KTable *self, uint32_t type,
const char *name, va_list args );
/* Lock
* apply lock
*
* if object is already locked, the operation is idempotent
* and returns an rc state of rcLocked
*
* "type" [ IN ] - a KDBPathType
* valid values are kptIndex and kptColumn
*
* "path" [ IN ] - NUL terminated path
*/
KDB_EXTERN rc_t CC KTableLock ( KTable *self, uint32_t type,
const char *name, ... );
KDB_EXTERN rc_t CC KTableVLock ( KTable *self, uint32_t type,
const char *name, va_list args );
/* Unlock
* remove lock
*
* if object is already unlocked, the operation is idempotent
* and returns an rc state of rcUnlocked
*
* "type" [ IN ] - a KDBPathType
* valid values are kptIndex and kptColumn
*
* "path" [ IN ] - NUL terminated path
*/
KDB_EXTERN rc_t CC KTableUnlock ( KTable *self, uint32_t type,
const char *name, ... );
KDB_EXTERN rc_t CC KTableVUnlock ( KTable *self, uint32_t type,
const char *name, va_list args );
/* Rename
* renames a contained object
*
* "from" [ IN ] - NUL terminated string in UTF-8
* giving name of contained object
*
* "to" [ IN ] - NUL terminated string in UTF-8
* giving new name
*/
KDB_EXTERN rc_t CC KTableRenameColumn ( KTable *self, bool force,
const char *from, const char *to );
KDB_EXTERN rc_t CC KTableRenameIndex ( KTable *self, bool force,
const char *from, const char *to );
/* Alias
* create an alias to an existing contained object
*
* "name" [ IN ] - NUL terminated string in UTF-8
* giving name of contained object
*
* "alias" [ IN ] - NUL terminated string in UTF-8
* giving aliased name
*/
KDB_EXTERN rc_t CC KTableAliasColumn ( KTable *self, const char *path, const char *alias );
KDB_EXTERN rc_t CC KTableAliasIndex ( KTable *self, const char *name, const char *alias );
/* Drop
* drop a contained object
*
* "name" [ IN ] - NUL terminated string in UTF-8 giving column name
*/
KDB_EXTERN rc_t CC KTableDropColumn ( KTable *self, const char *name, ... );
KDB_EXTERN rc_t CC KTableDropIndex ( KTable *self, const char *name, ... );
KDB_EXTERN rc_t CC KTableVDropColumn ( KTable *self, const char *name, va_list args );
KDB_EXTERN rc_t CC KTableVDropIndex ( KTable *self, const char *name, va_list args );
/* Reindex
* optimize column indices
*/
KDB_EXTERN rc_t CC KTableReindex ( KTable *self );
/* OpenManager
* duplicate reference to manager
* NB - returned reference must be released
*/
KDB_EXTERN rc_t CC KTableOpenManagerRead ( const KTable *self, struct KDBManager const **mgr );
KDB_EXTERN rc_t CC KTableOpenManagerUpdate ( KTable *self, struct KDBManager **mgr );
/* OpenParent
* duplicate reference to parent database
* NB - returned reference must be released
*/
KDB_EXTERN rc_t CC KTableOpenParentRead ( const KTable *self, struct KDatabase const **db );
KDB_EXTERN rc_t CC KTableOpenParentUpdate ( KTable *self, struct KDatabase **db );
#ifdef __cplusplus
}
#endif
#endif /* _h_kdb_table_ */
sra_sdk-2.1.7/interfaces/kdb/extern.h 0000644 0012213 0011620 00000002753 11476747550 017223 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kdb_extern_
#define _h_kdb_extern_
#if ! defined EXPORT_LATCH && defined _LIBRARY
#define KDB_EXTERN LIB_EXPORT
#define EXPORT_LATCH 1
#else
#define KDB_EXTERN LIB_IMPORT
#endif
#ifndef _h_klib_extern_
#include
#endif
#endif /* _h_kdb_extern_ */
sra_sdk-2.1.7/interfaces/kdb/btree.h 0000664 0012213 0011620 00000022037 11625212552 016777 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kdb_btree_
#define _h_kdb_btree_
#ifndef _h_kdb_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* defines
*/
/* KEY2ID
* the original behavior of btree was to perform key=>value mapping
* by converting to a key=>id mapping, no values are stored in the b-tree
* page file, allowing for an external storage
*/
#ifndef BTREE_KEY2ID
#define BTREE_KEY2ID 1
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KFile;
/*--------------------------------------------------------------------------
* KBTreeCompareFunc
*/
typedef int ( CC * KBTreeCompareFunc )
( const void *a, size_t asize, const void *b, size_t bsize );
#if ! BTREE_KEY2ID
/*--------------------------------------------------------------------------
* KBTreeValue
* gives access to a value within a data page
*/
typedef struct KBTreeValue KBTreeValue;
struct KBTreeValue
{
uint64_t data [ 3 ];
};
/* Whack
* destroys object for further use
* may write modifications to disk ( see "write_through" below )
*/
KDB_EXTERN rc_t CC KBTreeValueWhack ( KBTreeValue *self );
/* AccessRead
* AccessUpdate
* gain access to value address
* update access marks data page as modified
*
* "mem" [ OUT ] - pointer to value
*
* "bytes" [ OUT, NULL OKAY ] - size of value memory
*/
KDB_EXTERN rc_t CC KBTreeValueAccessRead ( const KBTreeValue *self,
const void **mem, size_t *bytes );
KDB_EXTERN rc_t CC KBTreeValueAccessUpdate ( KBTreeValue *self,
void **mem, size_t *bytes );
#endif /* BTREE_KEY2ID */
/*--------------------------------------------------------------------------
* KBTree
* this implementation is an extremely simplified structure
* meant to provide the ability to create an index for temporary use
*/
typedef struct KBTree KBTree;
/* KBTreeKeyType
* describes the type of key to be used
*/
typedef uint8_t KBTreeKeyType;
enum
{
kbtOpaqueKey, /* key is a ( void*, size_t ) pair */
#if 0
kbtNulTermCharKey, /* key is a NUL-terminated char [] */
kbtStringKey, /* key is a String* */
kbtInt8Key, /* key is an int8_t */
kbtInt16Key, /* key is an int16_t */
kbtInt32Key, /* key is an int32_t */
kbtInt64Key, /* key is an int64_t */
kbtUint8Key, /* key is a uint8_t */
kbtUint16Key, /* key is a uint16_t */
kbtUint32Key, /* key is a uint32_t */
kbtUint64Key, /* key is a uint64_t */
kbtFloatKey, /* key is a float */
kbtDoubleKey, /* key is a double */
#endif
kbtLastDefined
};
/* MakeRead
* MakeUpdate
* make a b-tree object backed by supplied KFile
*
* "backing" [ IN ] - open file with appropriate permissions:
* read is required in all cases, and write is required for update.
* NB - a reference will be attached to this file.
*
* "climit" [ IN ] - cache limit in bytes. the internal cache will
* retain UP TO ( but not exceeding ) the limit specified. a value
* of 0 ( zero ) will disable caching.
*
* "write_through" [ IN ] - if true, causes flushing of modified page
* after its value is released
*
* "type" [ IN ] - describes the key type ( see above )
*
* "key_chunk_size" [ IN ] - the "chunking" ( alignment ) factor for
* storing keys, rounded up to the nearest power of 2.
*
* "value_chunk_size" [ IN ] - chunking factor for values
* ( see "key_chunk_size" )
*
* "min_key_size" [ IN ] and "max_key_size" [ IN ] - specifies the allowed
* opaque key sizes. min == max implies fixed size. ignored for well
* known fixed size key types.
*
* "min_value_size" [ IN ] and "max_value_size" [ IN ] - specifies the allowed
* value sizes. min == max implies fixed size.
*
* "cmp" [ IN, NULL OKAY ] - optional comparison callback function for opaque keys.
* specific key types will use internal comparison functions. for opaque keys, a
* NULL function pointer will cause ordering by size and binary comparison.
*/
KDB_EXTERN rc_t CC KBTreeMakeRead ( const KBTree **bt,
struct KFile const *backing, size_t climit, KBTreeCompareFunc cmp );
#if BTREE_KEY2ID
KDB_EXTERN rc_t CC KBTreeMakeUpdate ( KBTree **bt, struct KFile *backing,
size_t climit, bool write_through, KBTreeKeyType type,
size_t min_key_size, size_t max_key_size,
KBTreeCompareFunc cmp );
#else
KDB_EXTERN rc_t CC KBTreeMakeUpdate ( KBTree **bt, struct KFile *backing,
size_t climit, bool write_through, KBTreeKeyType type,
size_t key_chunk_size, size_t value_chunk_size,
size_t min_key_size, size_t max_key_size,
size_t min_value_size, size_t max_value_size,
KBTreeCompareFunc cmp );
#endif
/* AddRef
* Release
* ignores NULL references
*/
KDB_EXTERN rc_t CC KBTreeAddRef ( const KBTree *self );
KDB_EXTERN rc_t CC KBTreeRelease ( const KBTree *self );
/* DropBacking
* used immediately prior to releasing
* prevents modified pages from being flushed to disk
* renders object nearly useless
*/
KDB_EXTERN rc_t CC KBTreeDropBacking ( KBTree *self );
/* Size
* returns size in bytes of file and cache
*
* "lsize" [ OUT, NULL OKAY ] - return parameter for logical size
*
* "fsize" [ OUT, NULL OKAY ] - return parameter for file size
*
* "csize" [ OUT, NULL OKAY ] - return parameter for cache size
*/
KDB_EXTERN rc_t CC KBTreeSize ( const KBTree *self,
uint64_t *lsize, uint64_t *fsize, size_t *csize );
/* Find
* searches for a match
*
* "val" [ OUT ] - return parameter for value found
* accessed via KBTreeValueAccess* described above
* must be balanced with a call to KBTreeValueWhack.
*
* "key" [ IN ] and "key_size" [ IN ] - describes an
* opaque key
*/
#if BTREE_KEY2ID
KDB_EXTERN rc_t CC KBTreeFind ( const KBTree *self, uint32_t *id,
const void *key, size_t key_size );
#else
KDB_EXTERN rc_t CC KBTreeFind ( const KBTree *self, KBTreeValue *val,
const void *key, size_t key_size );
#endif
/* Entry
* searches for a match or creates a new entry
*
* "val" [ OUT ] - return parameter for value found
* accessed via KBTreeValueAccess* described above
* must be balanced with a call to KBTreeValueWhack.
*
* "was_inserted" [ OUT ] - if true, the returned value was the result of an
* insertion and can be guaranteed to be all 0 bits. otherwise, the returned
* value will be whatever was there previously.
*
* "alloc_size" [ IN ] - the number of value bytes to allocate upon insertion,
* i.e. if the key was not found. this value must agree with the limits
* specified in Make ( see above ).
*
* "key" [ IN ] and "key_size" [ IN ] - describes an
* opaque key
*/
#if BTREE_KEY2ID
KDB_EXTERN rc_t CC KBTreeEntry ( KBTree *self, uint32_t *id,
bool *was_inserted, const void *key, size_t key_size );
#else
KDB_EXTERN rc_t CC KBTreeEntry ( KBTree *self, KBTreeValue *val,
bool *was_inserted, size_t alloc_size,
const void *key, size_t key_size );
#endif
/* ForEach
* executes a function on each tree element
*
* "reverse" [ IN ] - if true, iterate in reverse order
*
* "f" [ IN ] and "data" [ IN, OPAQUE ] - callback function
*/
#if BTREE_KEY2ID
KDB_EXTERN rc_t CC KBTreeForEach ( const KBTree *self, bool reverse,
void ( CC * f ) ( const void *key, size_t key_size, uint32_t id, void *data ), void *data );
#else
KDB_EXTERN rc_t CC KBTreeForEach ( const KBTree *self, bool reverse,
void ( CC * f ) ( const void *key, size_t key_size, KBTreeValue *val, void *data ), void *data );
#endif
#ifdef __cplusplus
}
#endif
#endif /* _h_kdb_btree_ */
sra_sdk-2.1.7/interfaces/kdb/consistency-check.h 0000664 0012213 0011620 00000006550 11604623557 021324 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
*============================================================================
*
*/
#ifndef _h_kdb_consistency_check_
#define _h_kdb_consistency_check_
#ifndef _h_kdb_extern_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KDatabase;
struct KTable;
struct KColumn;
/*--------------------------------------------------------------------------
* CCReportTypes
*/
enum
{
ccrpt_Done,
ccrpt_MD5,
ccrpt_Blob,
ccrpt_Index
};
/*--------------------------------------------------------------------------
* CCReportInfoBlock
*/
typedef struct CCReportInfoBlock CCReportInfoBlock;
struct CCReportInfoBlock
{
const char *objName;
uint32_t objId;
uint32_t objType;
uint32_t type;
union
{
struct /* ccrb_done_s */
{
const char *mesg;
rc_t rc;
} done;
struct ccrb_md5_s
{
const char *file;
rc_t rc;
} MD5;
struct ccrb_blob_s
{
uint64_t start;
uint64_t count;
} blob;
struct ccrb_index_s
{
int64_t start_id;
uint64_t id_range;
uint64_t num_keys;
uint64_t num_rows;
uint64_t num_holes;
} index;
} info;
};
typedef rc_t ( CC *CCReportFunc ) ( const CCReportInfoBlock *info, void *data );
/*--------------------------------------------------------------------------
* KDatabase
*/
KDB_EXTERN rc_t CC KDatabaseConsistencyCheck ( struct KDatabase const *self,
uint32_t level, CCReportFunc report, void *data );
/*--------------------------------------------------------------------------
* KTable
*/
KDB_EXTERN rc_t CC KTableConsistencyCheck ( struct KTable const *self,
uint32_t level, CCReportFunc report, void *data );
/*--------------------------------------------------------------------------
* KColumn
*/
KDB_EXTERN rc_t CC KColumnConsistencyCheck ( struct KColumn const *self,
uint32_t level, CCReportInfoBlock *info, CCReportFunc report, void *data );
#ifdef __cplusplus
}
#endif
#endif /* _h_kdb_consistency_check_ */
sra_sdk-2.1.7/interfaces/kfg/ 0000755 0012213 0011620 00000000000 11625217221 015524 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/kfg/config.h 0000644 0012213 0011620 00000016520 11625212552 017150 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfg_config_
#define _h_kfg_config_
#ifndef _h_kfg_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#include
#ifdef __cplusplus
extern "C" {
#endif
/*
* This flag has important ramifications to all programs.
* If set then all programs that use KMain()/KMane()
* become dependant on the kfg and kfs libraries.
*
* This will also modify the behavior of program tear down.
* if unset the memory used by the singleton config manager
* will not be freed.
*/
#define KFG_COMMON_CREATION 0
/*--------------------------------------------------------------------------
* KConfig
* configuration paramter manager
*/
typedef struct KConfig KConfig;
struct KDirectory;
/* Make
* create a process-global configuration manager
*
* "cfg" [ OUT ] - return parameter for mgr
*
* "optional_search_base" [ IN, NULL OKAY ]
*/
KFG_EXTERN rc_t CC KConfigMake ( KConfig **cfg,
struct KDirectory const * optional_search_base );
/* AddRef
* Release
*/
KFG_EXTERN rc_t CC KConfigAddRef ( const KConfig *self );
KFG_EXTERN rc_t CC KConfigRelease ( const KConfig *self );
/* LoadFile
* loads a configuration file
*/
struct KFile;
KFG_EXTERN rc_t CC KConfigLoadFile ( KConfig * self,
const char * path, struct KFile const * file );
/*--------------------------------------------------------------------------
* KConfigNode
* node within configuration tree
*/
typedef struct KConfigNode KConfigNode;
/* AddRef
* Release
* all objects are reference counted
* NULL references are ignored
*/
KFG_EXTERN rc_t CC KConfigNodeAddRef ( const KConfigNode *self );
KFG_EXTERN rc_t CC KConfigNodeRelease ( const KConfigNode *self );
/* OpenNodeRead
* VOpenNodeRead
* opens a configuration node
*
* "node" [ OUT ] - return parameter for indicated configuration node
*
* "path" [ IN, NULL OKAY ] - optional path for specifying named
* node within configuration hierarchy. paths will be interpreted as
* if they were file system paths, using '/' as separator. the
* special values NULL and "" are interpreted as "."
*/
KFG_EXTERN rc_t CC KConfigOpenNodeRead ( const KConfig *self,
const KConfigNode **node, const char *path, ... );
KFG_EXTERN rc_t CC KConfigNodeOpenNodeRead ( const KConfigNode *self,
const KConfigNode **node, const char *path, ... );
KFG_EXTERN rc_t CC KConfigVOpenNodeRead ( const KConfig *self,
const KConfigNode **node, const char *path, va_list args );
KFG_EXTERN rc_t CC KConfigNodeVOpenNodeRead ( const KConfigNode *self,
const KConfigNode **node, const char *path, va_list args );
/* OpenNodeUpdate
* VOpenNodeUpdate
* opens a configuration node
*
* "node" [ OUT ] - return parameter for indicated configuration node
*
* "path" [ IN, NULL OKAY ] - optional path for specifying named
* node within configuration hierarchy. paths will be interpreted as
* if they were file system paths, using '/' as separator. the
* special values NULL and "" are interpreted as "."
*/
KFG_EXTERN rc_t CC KConfigOpenNodeUpdate ( KConfig *self,
KConfigNode **node, const char *path, ... );
KFG_EXTERN rc_t CC KConfigNodeOpenNodeUpdate ( KConfigNode *self,
KConfigNode **node, const char *path, ... );
KFG_EXTERN rc_t CC KConfigVOpenNodeUpdate ( KConfig *self,
KConfigNode **node, const char *path, va_list args );
KFG_EXTERN rc_t CC KConfigNodeVOpenNodeUpdate ( KConfigNode *self,
KConfigNode **node, const char *path, va_list args );
/* Read
* read a node value
*
* "offset" [ IN ] - initial offset into configuration
*
* "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
*
* "num_read" [ OUT ] - number of bytes actually read
*
* "remaining" [ OUT, NULL OKAY ] - optional return parameter for
* the number of bytes remaining to be read.
* specifically, "offset" + "num_read" + "remaining" == sizeof node data
*/
KFG_EXTERN rc_t CC KConfigNodeRead ( const KConfigNode *self,
size_t offset, char *buffer, size_t bsize,
size_t *num_read, size_t *remaining );
/* ListChild
* list all named children
*/
struct KNamelist;
KFG_EXTERN rc_t CC KConfigNodeListChild ( const KConfigNode *self,
struct KNamelist **names );
/* Write
* write a node value or attribute
* overwrites anything already there
*
* "buffer" [ IN ] and "size" [ IN ] - new value data
*/
KFG_EXTERN rc_t CC KConfigNodeWrite ( KConfigNode *self, const char *buffer, size_t size );
/* Append
* append data to value
*
* "buffer" [ IN ] and "size" [ IN ] - value data to be appended
*/
KFG_EXTERN rc_t CC KConfigNodeAppend ( KConfigNode *self, const char *buffer, size_t size );
/* ReadAttr
* reads as NUL-terminated string
*
* "name" [ IN ] - NUL terminated attribute name
*
* "buffer" [ OUT ] and "bsize" - return parameter for attribute value
*
* "size" [ OUT ] - return parameter giving size of string
* not including NUL byte. the size is set both upon success
* and insufficient buffer space error.
*/
KFG_EXTERN rc_t CC KConfigNodeReadAttr ( const KConfigNode *self, const char *name,
char *buffer, size_t bsize, size_t *size );
/* WriteAttr
* writes NUL-terminated string
*
* "name" [ IN ] - NUL terminated attribute name
*
* "value" [ IN ] - NUL terminated attribute value
*/
KFG_EXTERN rc_t CC KConfigNodeWriteAttr ( KConfigNode *self,
const char *name, const char *value );
/* Drop
* VDrop
* drop some or all node content
*/
KFG_EXTERN rc_t CC KConfigNodeDropAll ( KConfigNode *self );
KFG_EXTERN rc_t CC KConfigNodeDropAttr ( KConfigNode *self, const char *attr );
KFG_EXTERN rc_t CC KConfigNodeDropChild ( KConfigNode *self, const char *path, ... );
KFG_EXTERN rc_t CC KConfigNodeVDropChild ( KConfigNode *self, const char *path, va_list args );
/* Rename
* renames a contained object
*
* "from" [ IN ] - NUL terminated string in UTF-8
* giving simple name of existing attr
*
* "to" [ IN ] - NUL terminated string in UTF-8
* giving new simple attr name
*/
KFG_EXTERN rc_t CC KConfigNodeRenameAttr ( KConfigNode *self, const char *from, const char *to );
KFG_EXTERN rc_t CC KConfigNodeRenameChild ( KConfigNode *self, const char *from, const char *to );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfg_config_ */
sra_sdk-2.1.7/interfaces/kfg/extern.h 0000644 0012213 0011620 00000002753 11476747550 017232 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfg_extern_
#define _h_kfg_extern_
#if ! defined EXPORT_LATCH && defined _LIBRARY
#define KFG_EXTERN LIB_EXPORT
#define EXPORT_LATCH 1
#else
#define KFG_EXTERN LIB_IMPORT
#endif
#ifndef _h_klib_extern_
#include
#endif
#endif /* _h_kfg_extern_ */
sra_sdk-2.1.7/interfaces/kfg/kfg-priv.h 0000664 0012213 0011620 00000003356 11625746070 017444 0 ustar rodarmer trace /*==============================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfg_priv_
#define _h_kfg_priv_
#ifndef _h_kfg_config_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* ListIncluded
* list all included files
*/
KFG_EXTERN rc_t CC KConfigListIncluded ( const KConfig *self,
struct KNamelist **names );
/* GetLoadPath
* return colon-separated search path to load KConfig
* NB. path should not be released
*/
KFG_EXTERN rc_t CC KConfigGetLoadPath ( const KConfig *self,
const char **path );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfg_priv_ */
sra_sdk-2.1.7/interfaces/kfs/ 0000755 0012213 0011620 00000000000 11613566242 015547 5 ustar rodarmer trace sra_sdk-2.1.7/interfaces/kfs/arc.h 0000644 0012213 0011620 00000010451 11645077605 016473 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_arc_
#define _h_kfs_arc_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#include
#ifdef __cplusplus
extern "C" {
#endif
struct KDirectory;
struct KToc;
struct vector;
/* validate_header_offsets
* This function is a special friend function to the archive package used
* to validate that the compiler used to build the package matches
* used structure offsets "correctly" to enable the parsing of TAR files.
* NOTE:
* This function should not be used except by ktartest (klib/tools/ktartest.c).
* It is built only in a special logging version of the libraries.
*/
KFS_EXTERN bool CC validate_header_offsets(void);
typedef struct KArcDir KArcDir;
typedef struct KArcFile KArcFile;
typedef uint32_t KArcFSType;
enum eKArcFSType
{
tocUnknown,
tocKFile,
tocKDirectory,
tocKVirtual
};
/* OpenArcDirRead
*
* This should probably move into the toc-priv with a specific call to open each archive type
* with the parse private and not needing the dad-gummed CC and KFS_EXTERN
* Open an archive file as a KDirectory derived type: made to match
* KDirectoryOpenDirRead() where parse could be the first element of arg
*
* [IN] dir A KDirectory (of any derived type) to reach the archive file
* [OUT] pdir The KDirectory (of type KArcDir) that will be created
* [IN] chroot if non-zero, the new directory becomes chroot'd and interprets paths
* stating with '/'
* [IN] path The path to the archive - this will become the directory path
* [IN] parse A pointer to the function needed to build a TOC by parsing the file
*
* parameters to parse
* REQUIRED: KToc *
* REQUIRED: void * KFile* | KDirectory* | ???
* OPTIONAL: bool (*)(const char*) Filter: include or skip this path
* OPTIONAL: rc_t (*)(???) Sort: reorder name list
*/
KFS_EXTERN rc_t CC KDirectoryOpenArcDirRead(const struct KDirectory * self,
const struct KDirectory ** pdir, bool chroot, const char * path, KArcFSType baseType,
rc_t ( CC * parse )(struct KToc *,const void *,
bool( CC * )(const struct KDirectory*, const char *, void*), void*),
bool (CC* filter )(const KDirectory*, const char *, void *), void * filterparam);
#if 0
/* ----------------------------------------------------------------------
* KDirectoryToKArcDir
*
* [IN] const KDirectory * self Object oriented C
* [OUT] const KArcDir * cast Object oriented C
*
*
* Get a reference to a KArcDir from a KDirectory as a cast. It is a new reference.
*/
KFS_EXTERN rc_t CC KDirectoryToKArcDir (const KDirectory * self, const KArcDir ** cast);
KFS_EXTERN rc_t CC KArcDirList ( const KArcDir *self, struct KNamelist **list,
bool ( CC * f ) ( const KArcDir *dir, const char *name, void *data ),
void *data, const char *path, ... );
KFS_EXTERN rc_t CC KArcDirVList ( const KArcDir *self, struct KNamelist **list,
bool ( CC * f ) ( const KArcDir *dir, const char *name, void *data ),
void *data, const char *path, va_list args );
#endif
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_arc_ */
sra_sdk-2.1.7/interfaces/kfs/buffile.h 0000644 0012213 0011620 00000004627 11542737113 017343 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_buffile_
#define _h_kfs_buffile_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KFile;
/*--------------------------------------------------------------------------
* KFile
*/
/* MakeBufferedRead
* make a read-only file buffer
*
* "buf" [ OUT ] - return parameter for new buffered file
*
* "original" [ IN ] - source file to be buffered. must have read access
*
* "bsize" [ IN ] - buffer size
*/
KFS_EXTERN rc_t CC KBufFileMakeRead ( struct KFile const ** buf,
struct KFile const * original, size_t bsize );
/* MakeBufferedWrite
* make a writable file buffer
*
* "buf" [ OUT ] - return parameter for new buffered file
*
* "original" [ IN ] - source file to be buffered. must have read access
*
* "update" [ IN ] - if true, make a read/write buffer
*
* "bsize" [ IN ] - buffer size
*/
KFS_EXTERN rc_t CC KBufFileMakeWrite ( struct KFile ** buf,
struct KFile * original, bool update, size_t bsize );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_buffile_ */
sra_sdk-2.1.7/interfaces/kfs/bzip.h 0000644 0012213 0011620 00000004605 11476747550 016703 0 ustar rodarmer trace /*=======================================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_bzip_
#define _h_kfs_bzip_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KFile;
/* MakeBzip2ForRead
* creates an adapter to bunzip2 a source file
*
* "bz" [ OUT ] - return parameter for decompressed file
*
* "src" [ IN ] - compressed source file with read permission
*
* NB - creates a read-only file that does NOT support random access
* i.e. must be consumed serially starting from offset 0
*/
KFS_EXTERN rc_t CC KFileMakeBzip2ForRead ( struct KFile const **bz, struct KFile const *src );
/* MakeBzip2ForWrite
* creates an adapter to gzip a source file
*
* "bz" [ OUT ] - return parameter for compressed file
*
* "src" [ IN ] - uncompressed source file with write permission
*
* NB - creates a write-only file that does NOT suppport random access
* i.e. must be written serially from offset 0
*/
KFS_EXTERN rc_t CC KFileMakeBzip2ForWrite ( struct KFile **bz, struct KFile *src );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_bzip_ */
sra_sdk-2.1.7/interfaces/kfs/countfile.h 0000644 0012213 0011620 00000005360 11625212552 017707 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_counterfile_
#define _h_kfs_counterfile_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct KFile;
typedef struct KCounterFile KCounterFile;
/* -----
* Copy can be a serialized type KFile for a KCounterFile opened for Read but
* not when opened for write.
*
* Specifically this means copy can be a KMD5File for read but not for write
* other KFile subtypes might have the same restriction.
*
* A seekless update KCounterfile can be created but does not now exist.
*
* bytecounter points to where to write a total byte count for the file.
*
* linecounter points to where to write a count of the lines of a file.
* if NULL this functionality is disabled.
*
* force_reads causes a read to the end of file on close rather than relying on pass along KFileSize
*/
KFS_EXTERN rc_t CC KFileMakeCounterRead (const struct KFile ** self, const KFile * original,
uint64_t * bytecounter, uint64_t * linecounter, bool force_reads);
KFS_EXTERN rc_t CC KFileMakeCounterWrite (struct KFile ** self, struct KFile * original,
uint64_t * bytecounter, uint64_t * linecounter, bool force_reads);
KFS_EXTERN rc_t CC KFileMakeCounterUpdate (struct KFile ** self, struct KFile * original,
uint64_t * bytecounter, uint64_t * linecounter, bool force_reads);
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_counterfile_ */
sra_sdk-2.1.7/interfaces/kfs/crc.h 0000644 0012213 0011620 00000021622 11476747550 016504 0 ustar rodarmer trace /*=======================================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_crc_
#define _h_kfs_crc_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KFile;
/*--------------------------------------------------------------------------
* KCRC32SumFmt
* a formatter for reading or writing an crc32sum-style checksum file
*/
typedef struct KCRC32SumFmt KCRC32SumFmt;
/* AddRef
* Release
*/
KFS_EXTERN rc_t CC KCRC32SumFmtAddRef ( const KCRC32SumFmt *self );
KFS_EXTERN rc_t CC KCRC32SumFmtRelease ( const KCRC32SumFmt *self );
/* Make
* creates a formatted accessor to textual checksum file
* takes over ownership of "in"/"out" file reference
*
* "in" [ IN ] - readable checksum input file
* -OR-
* "out" [ IN ] - writable checksum file. if readable as well,
* its contents will be preserved.
*/
KFS_EXTERN rc_t CC KCRC32SumFmtMakeRead ( const KCRC32SumFmt **f, struct KFile const *in );
KFS_EXTERN rc_t CC KCRC32SumFmtMakeUpdate ( KCRC32SumFmt **f, struct KFile *out );
/* Count
* return the number of checksums in file
*/
KFS_EXTERN rc_t CC KCRC32SumFmtCount ( const KCRC32SumFmt *self, uint32_t *count );
/* Get
* retrieve an indexed checksum line
*
* "idx" [ IN ] - zero-based index of checksum to access
*
* "path" [ OUT ] and "size" [ IN ] - return buffer for file path
*
* "crc32" [ OUT ] - return parameter for the checksum
*
* "bin" [ OUT, NULL OKAY ] - true if fopen mode used to
* calculate "digest" was binary, false if text. pertinent if
* digest was calculated using DOS text mode.
*/
KFS_EXTERN rc_t CC KCRC32SumFmtGet ( const KCRC32SumFmt *self, uint32_t idx,
char *path, size_t size, uint32_t *crc32, bool *bin );
/* Find
* retrieve checksum line by path
*
* "path" [ IN ] - NUL terminated string in OS-native char set
* denoting path to file
*
* "crc32" [ OUT ] - return parameter for the checksum
*
* "bin" [ OUT, NULL OKAY ] - true if fopen mode used to
* calculate "digest" was binary, false if text. pertinent if
* digest was calculated using DOS text mode.
*/
KFS_EXTERN rc_t CC KCRC32SumFmtFind ( const KCRC32SumFmt *self,
const char *path, uint32_t *crc32, bool *bin );
/* Delete
* remove an existing line
*
* "path" [ IN ] - NUL terminated string in OS-native char set
* denoting path to file
*
* returns rcNotFound if not present
*/
KFS_EXTERN rc_t CC KCRC32SumFmtDelete ( KCRC32SumFmt *self, const char *path );
/* Update
* add a checksum line to file or update an existing line
*
* "path" [ IN ] - NUL terminated string in OS-native char set
* denoting path to file
*
* "crc32" [ IN ] - calculated checksum
*
* "bin" [ IN ] - true if checksum was calculated on all bytes
* in file, false if fopen mode used to read file was text.
*
* NB - the crc32sum tool was designed to behave like md5sum.
* the md5sum tool operates with the assumption that files
* are opened using "fopen". it records the mode used by prepending
* '*' to indicate binary and ' ' to indicate text mode within the
* checksum line.
*
* unfortunately, this creates a situation where text-mode files
* checksummed on DOS cannot be properly checked on any other
* platform without the aid of some filter to drop out '\r' from
* a '\r\n' sequence.
*
* fortunately, most users are unaware of the binary/text mode
* switches available with md5sum and use the default mode, which
* is binary on DOS and text on Unix, which happens to be equivalent
* to binary ( making one wonder why binary is not instead the
* universal default ).
*
* the end result is that we need to indicate whether CR stripping
* was performed while at the same time behaving like md5sum.
*/
KFS_EXTERN rc_t CC KCRC32SumFmtUpdate ( KCRC32SumFmt *self, const char *path,
uint32_t crc32, bool bin );
/* Rename
* Rename the checksum line to reflect a file name change but no content change.
*
* "newpath" [ IN ] - NUL terminated string in OS-native char set
* denoting path to file's new name
*
* "oldpath" [ IN ] - NUL terminated string in OS-native char set
* denoting path to file's old name
*
* Parameter order matches KDirectoryRename()
*/
KFS_EXTERN rc_t CC KCRC32SumFmtRename ( KCRC32SumFmt *self, const char *oldpath, const char *newpath );
/* Flush
* write data to disk, but stay open
*/
KFS_EXTERN rc_t CC KCRC32SumFmtFlush ( KCRC32SumFmt *self );
/*--------------------------------------------------------------------------
* CRC32 KFile extensions
*/
/* MakeCRC32Read
* creates an adapter to check CRC32 checksum for a source file
*
* "f" [ OUT ] - return parameter for file with crc check
*
* "src" [ IN ] - source file with read permission
*
* "crc32" [ IN ] - checksum to match
*
* NB - creates a read-only file that does NOT support random access
* i.e. must be consumed serially starting from offset 0
*/
KFS_EXTERN rc_t CC KFileMakeCRC32Read ( struct KFile const **f,
struct KFile const *src, uint32_t crc32 );
/*--------------------------------------------------------------------------
* KCRC32File
* subclass of KFile
*/
typedef struct KCRC32File KCRC32File;
/* MakeWrite
* MakeAppend
* creates an adapter to calculate CRC checksum for a file
*
* "f" [ OUT ] - return parameter for file with crc check
*
* "out" [ IN ] - output file with write permission
* since this file is being wrapped by "f", ownership of
* the provided reference is transferred to "f"
*
* "fmt" [ IN ] - checksum output formatter.
* since this may be used for multiple checksums, "f" will
* attach its own reference to "fmt".
*
* "path" [ IN ] - checksum output file path, used to
* create standard md5sum file entry.
*
* NB - creates a write-only file that does NOT suppport random access
* i.e. must be written serially from offset 0
*/
KFS_EXTERN rc_t CC KCRC32FileMakeWrite ( KCRC32File **f,
struct KFile *out, KCRC32SumFmt *fmt, const char *path );
KFS_EXTERN rc_t CC KCRC32FileMakeAppend ( KCRC32File **f,
struct KFile *out, KCRC32SumFmt *fmt, const char *path );
/* MakeReadNew
* creates an adapter to calculate CRC checksum for a file
*
* "f" [ OUT ] - return parameter for file with crc check
*
* "in" [ IN ] - input file
* since this file is being wrapped by "f", ownership of
* the provided reference is transferred to "f"
*
* "fmt" [ IN ] - checksum output formatter.
* since this may be used for multiple checksums, "f" will
* attach its own reference to "fmt".
*
* "path" [ IN ] - checksum output file path, used to
* create standard md5sum file entry.
*
* NB - creates a write-only file that does NOT suppport random access
* i.e. must be written serially from offset 0
*/
KFS_EXTERN rc_t CC KFileMakeNewCRC32Read ( const struct KFile **fp,
const struct KFile *in, KCRC32SumFmt *fmt, const char *path );
/* ToKFile
* a CRC32 file is a subclass of KFile
* this is an explicit cast operator
*/
KFS_EXTERN struct KFile* CC KCRC32FileToKFile ( KCRC32File *self );
KFS_EXTERN struct KFile const* CC KCRC32FileToKFileConst ( const KCRC32File *self );
/* BeginTransaction
* preserve current CRC state and file marker
* in preparation for rollback
*/
KFS_EXTERN rc_t CC KCRC32FileBeginTransaction ( KCRC32File *self );
/* Commit
* accept current CRC state as correct
*/
KFS_EXTERN rc_t CC KCRC32FileCommit ( KCRC32File *self );
/* Revert
* reset state to previous transaction boundary conditions
*/
KFS_EXTERN rc_t CC KCRC32FileRevert ( KCRC32File *self );
/* Reset
* reset state to that of an empty file
* aborts any open transaction
*/
KFS_EXTERN rc_t CC KCRC32FileReset ( KCRC32File *self );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_crc_ */
sra_sdk-2.1.7/interfaces/kfs/directory.h 0000644 0012213 0011620 00000041071 11613563330 017722 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_directory_
#define _h_kfs_directory_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifndef _h_kfs_defs_
#include
#endif
#include
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KFile;
struct KNamelist;
/*--------------------------------------------------------------------------
* KDirectory
* a container node within file system
*/
typedef struct KDirectory KDirectory;
/* AddRef
* Release
* ignores NULL references
*/
KFS_EXTERN rc_t CC KDirectoryAddRef ( const KDirectory *self );
KFS_EXTERN rc_t CC KDirectoryRelease ( const KDirectory *self );
/* List
* create a directory listing
*
* "list" [ OUT ] - return parameter for list object
*
* "f" [ IN, NULL OKAY ] and "data" [ IN, OPAQUE ] - optional
* filter function to execute on each path. receives a base directory
* and relative path for each entry. if "f" returns true, the name will
* be added to the list.
*
* "path" [ IN, NULL OKAY ] - optional parameter for target
* directory. if NULL or empty, interpreted to mean "."
*/
KFS_EXTERN rc_t CC KDirectoryList ( const KDirectory *self, struct KNamelist **list,
bool ( CC * f ) ( const KDirectory *dir, const char *name, void *data ),
void *data, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVList ( const KDirectory *self, struct KNamelist **list,
bool ( CC * f ) ( const KDirectory *dir, const char *name, void *data ),
void *data, const char *path, va_list args );
/* Visit
* visit each path under designated directory,
* recursively if so indicated
*
* "recurse" [ IN ] - if true, recursively visit sub-directories
*
* "f" [ IN ] and "data" [ IN, OPAQUE ] - function to execute
* on each path. receives a base directory and relative path
* for each entry. if "f" returns true, the iteration will
* terminate and that value will be returned. NB - "dir" will not
* be the same as "self".
*
* "path" [ IN, NULL OKAY ] - optional NUL terminated string
* in directory-native character set. if NULL or empty, interpreted to mean "."
*
* VisitFull hits all files types that including those are normally hidden
*/
KFS_EXTERN rc_t CC KDirectoryVisit ( const KDirectory *self, bool recurse,
rc_t ( CC * f ) ( const KDirectory *dir, uint32_t type, const char *name, void *data ),
void *data, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVVisit ( const KDirectory *self, bool recurse,
rc_t ( CC * f ) ( const KDirectory *dir, uint32_t type, const char *name, void *data ),
void *data, const char *path, va_list args );
/* VisitUpdate
* like Visit except that the directory passed back to "f"
* is available for update operations
*/
KFS_EXTERN rc_t CC KDirectoryVisitUpdate ( KDirectory *self, bool recurse,
rc_t ( CC * f ) ( KDirectory *dir, uint32_t type, const char *name, void *data ),
void *data, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVVisitUpdate ( KDirectory *self, bool recurse,
rc_t ( CC * f ) ( KDirectory *dir, uint32_t type, const char *name, void *data ),
void *data, const char *path, va_list args );
/* PathType
* returns a KPathType
*
* "path" [ IN ] - NUL terminated string in directory-native character set
*/
KFS_EXTERN uint32_t CC KDirectoryPathType ( const KDirectory *self,
const char *path, ... );
KFS_EXTERN uint32_t CC KDirectoryVPathType ( const KDirectory *self,
const char *path, va_list args );
/* ResolvePath
* resolves path to an absolute or directory-relative path
*
* "absolute" [ IN ] - if true, always give a path starting
* with '/'. NB - if the directory is chroot'd, the absolute path
* will still be relative to directory root.
*
* "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
* NUL terminated result path in directory-native character set
* the resolved path will be directory relative
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target path. NB - need not exist.
*/
KFS_EXTERN rc_t CC KDirectoryResolvePath ( const KDirectory *self, bool absolute,
char *resolved, size_t rsize, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVResolvePath ( const KDirectory *self, bool absolute,
char *resolved, size_t rsize, const char *path, va_list args );
/* ResolveAlias
* resolves an alias path to its immediate target
* NB - the resolved path may be yet another alias
*
* "absolute" [ IN ] - if true, always give a path starting
* with '/'. NB - if the directory is chroot'd, the absolute path
* will still be relative to directory root.
*
* "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
* NUL terminated result path in directory-native character set
* the resolved path will be directory relative
*
* "alias" [ IN ] - NUL terminated string in directory-native
* character set denoting an object presumed to be an alias.
*/
KFS_EXTERN rc_t CC KDirectoryResolveAlias ( const KDirectory *self, bool absolute,
char *resolved, size_t rsize, const char *alias, ... );
KFS_EXTERN rc_t CC KDirectoryVResolveAlias ( const KDirectory *self, bool absolute,
char *resolved, size_t rsize, const char *alias, va_list args );
/* Rename
* rename an object accessible from directory, replacing
* any existing target object of the same type
*
* "from" [ IN ] - NUL terminated string in directory-native
* character set denoting existing object
*
* "to" [ IN ] - NUL terminated string in directory-native
* character set denoting existing object
*
* "force" [ IN ] - not false means try to do more if it fails internally
*/
KFS_EXTERN rc_t CC KDirectoryRename ( KDirectory *self, bool force, const char *from, const char *to );
/* Remove
* remove an accessible object from its directory
*
* "force" [ IN ] - if true and target is a directory,
* remove recursively
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target object
*/
KFS_EXTERN rc_t CC KDirectoryRemove ( KDirectory *self, bool force,
const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVRemove ( KDirectory *self, bool force,
const char *path, va_list args );
/* ClearDir
* remove all directory contents
*
* "force" [ IN ] - if true and directory entry is a
* sub-directory, remove recursively
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target directory
*/
KFS_EXTERN rc_t CC KDirectoryClearDir ( KDirectory *self, bool force,
const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVClearDir ( KDirectory *self, bool force,
const char *path, va_list args );
/* Access
* get access to object
*
* "access" [ OUT ] - return parameter for Unix access mode
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target object
*/
KFS_EXTERN rc_t CC KDirectoryAccess ( const KDirectory *self,
uint32_t *access, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVAccess ( const KDirectory *self,
uint32_t *access, const char *path, va_list args );
/* SetAccess
* set access to object a la Unix "chmod"
*
* "recurse" [ IN ] - if non zero and "path" is a directory,
* apply changes recursively.
*
* "access" [ IN ] and "mask" [ IN ] - definition of change
* where "access" contains new bit values and "mask defines
* which bits should be changed.
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target object
*/
KFS_EXTERN rc_t CC KDirectorySetAccess ( KDirectory *self, bool recurse,
uint32_t access, uint32_t mask, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVSetAccess ( KDirectory *self, bool recurse,
uint32_t access, uint32_t mask, const char *path, va_list args );
/* Date
* get date/time to object
*
* "date" [ OUT ] - return parameter
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target object
*/
KFS_EXTERN rc_t CC KDirectoryDate ( const KDirectory *self,
KTime_t *date, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVDate ( const KDirectory *self,
KTime_t *date, const char *path, va_list args );
/* SetDate
* set date to object
*
* "recurse" [ IN ] - if non zero and "path" is a directory,
* apply changes recursively.
*
* "date" [ IN ] - new time and date for the object
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target object
*/
KFS_EXTERN rc_t CC KDirectorySetDate ( KDirectory *self, bool recurse,
KTime_t date, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVSetDate ( KDirectory *self, bool recurse,
KTime_t date, const char *path, va_list args );
/* CreateAlias
* creates a path alias according to create mode
*
* "access" [ IN ] - standard Unix directory access mode
* used when "mode" has kcmParents set and alias path does
* not exist.
*
* "mode" [ IN ] - a creation mode ( see explanation above ).
*
* "targ" [ IN ] - NUL terminated string in directory-native
* character set denoting target object
*
* "alias" [ IN ] - NUL terminated string in directory-native
* character set denoting target alias
*/
KFS_EXTERN rc_t CC KDirectoryCreateAlias ( KDirectory *self,
uint32_t access, KCreateMode mode,
const char *targ, const char *alias );
/* OpenFileRead
* opens an existing file with read-only access
*
* "f" [ OUT ] - return parameter for newly opened file
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target file
*/
KFS_EXTERN rc_t CC KDirectoryOpenFileRead ( const KDirectory *self,
struct KFile const **f, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVOpenFileRead ( const KDirectory *self,
struct KFile const **f, const char *path, va_list args );
/* OpenFileWrite
* opens an existing file with write access
*
* "f" [ OUT ] - return parameter for newly opened file
*
* "update" [ IN ] - if true, open in read/write mode
* otherwise, open in write-only mode
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target file
*/
KFS_EXTERN rc_t CC KDirectoryOpenFileWrite ( KDirectory *self,
struct KFile **f, bool update, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVOpenFileWrite ( KDirectory *self,
struct KFile **f, bool update, const char *path, va_list args );
/* CreateFile
* opens a file with write access
*
* "f" [ OUT ] - return parameter for newly opened file
*
* "update" [ IN ] - if true, open in read/write mode
* otherwise, open in write-only mode
*
* "access" [ IN ] - standard Unix access mode, e.g. 0664
*
* "mode" [ IN ] - a creation mode ( see explanation above ).
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target file
*/
KFS_EXTERN rc_t CC KDirectoryCreateFile ( KDirectory *self, struct KFile **f,
bool update, uint32_t access, KCreateMode mode, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVCreateFile ( KDirectory *self, struct KFile **f,
bool update, uint32_t access, KCreateMode mode, const char *path, va_list args );
/* FileSize
* returns size in bytes of target file
*
* "size" [ OUT ] - return parameter for file size
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target file
*/
KFS_EXTERN rc_t CC KDirectoryFileSize ( const KDirectory *self,
uint64_t *size, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVFileSize ( const KDirectory *self,
uint64_t *size, const char *path, va_list args );
/* FilePhysicalSize
* returns physical allocated size in bytes of target file. It might
* or might not differ form FileSize
*
* "size" [ OUT ] - return parameter for file size
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target file
*/
KFS_EXTERN rc_t CC KDirectoryFilePhysicalSize ( const KDirectory *self,
uint64_t *size, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVFilePhysicalSize ( const KDirectory *self,
uint64_t *size, const char *path, va_list args );
/* SetFileSize
* sets size in bytes of target file
*
* "size" [ IN ] - new file size
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target file
*/
KFS_EXTERN rc_t CC KDirectorySetFileSize ( KDirectory *self,
uint64_t size, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVSetFileSize ( KDirectory *self,
uint64_t size, const char *path, va_list args );
/* FileLocator
* returns a 64-bit key pretinent only to the particular file
* system device holding tha file.
*
* It can be used as a form of sort key except that it is not
* guaranteed to be unique.
*
* "locator" [ OUT ] - return parameter for file locator
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target file
*/
KFS_EXTERN rc_t CC KDirectoryFileLocator ( const KDirectory *self,
uint64_t *locator, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVFileLocator ( const KDirectory *self,
uint64_t *locator, const char *path, va_list args );
/* FileContiguous
* returns size in bytes of target file
*
* "size" [ OUT ] - return parameter for file size
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target file
*/
KFS_EXTERN rc_t CC KDirectoryFileContiguous ( const KDirectory *self,
bool *contiguous, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVFileContiguous ( const KDirectory *self,
bool *contiguous, const char *path, va_list args );
/* OpenDirRead
* OpenDirUpdate
* opens a sub-directory
*
* "chroot" [ IN ] - if true, the new directory becomes
* chroot'd and will interpret paths beginning with '/'
* relative to itself.
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target directory
*/
KFS_EXTERN rc_t CC KDirectoryOpenDirRead ( const KDirectory *self,
const KDirectory **sub, bool chroot, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVOpenDirRead ( const KDirectory *self,
const KDirectory **sub, bool chroot, const char *path, va_list args );
KFS_EXTERN rc_t CC KDirectoryOpenDirUpdate ( KDirectory *self,
KDirectory **sub, bool chroot, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVOpenDirUpdate ( KDirectory *self,
KDirectory **sub, bool chroot, const char *path, va_list args );
/* CreateDir
* create a sub-directory
*
* "access" [ IN ] - standard Unix directory mode, e.g.0775
*
* "mode" [ IN ] - a creation mode ( see explanation above ).
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target directory
*/
KFS_EXTERN rc_t CC KDirectoryCreateDir ( KDirectory *self,
uint32_t access, KCreateMode mode, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVCreateDir ( KDirectory *self,
uint32_t access, KCreateMode mode, const char *path, va_list args );
/* NativeDir
* returns a native file-system directory node reference
* the directory root will be "/" and set to the native
* idea of current working directory
*
* NB - the returned reference will be non-const, allowing
* modification operations to be attempted. these operations
* may still fail if the underlying FS disallows them.
*
* "dir" [ OUT ] - return parameter for native directory
*/
KFS_EXTERN rc_t CC KDirectoryNativeDir ( KDirectory **dir );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_directory_ */
sra_sdk-2.1.7/interfaces/kfs/directory.hpp 0000644 0012213 0011620 00000050071 11520072536 020262 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _hpp_kfs_directory_
#define _hpp_kfs_directory_
#ifndef _h_kfs_directory_
#include
#endif
/*--------------------------------------------------------------------------
* KDirectory
* a container node within file system
*/
struct KDirectory {
/* AddRef
* Release
* ignores NULL references
*/
inline rc_t AddRef ( void ) const throw ()
{ return KDirectoryAddRef ( this ); }
inline rc_t Release ( void ) const throw ()
{ return KDirectoryRelease ( this ); }
/* List
* create a directory listing
*
* "list" [ OUT ] - return parameter for list object
*
* "f" [ IN, NULL OKAY ] and "data" [ IN, OPAQUE ] - optional
* filter function to execute on each path. receives a base directory
* and relative path for each entry. if "f" returns true, the name will
* be added to the list.
*
* "path" [ IN, NULL OKAY ] - optional parameter for target
* directory. if NULL, interpreted to mean "."
*/
inline rc_t List ( struct KNamelist **list,
bool ( CC * f ) ( const KDirectory *dir, const char *name, void *data ),
void *data,
const char *path, ... ) const throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVList ( this, list, f, data, path, args );
va_end ( args );
return rc;
}
inline rc_t List ( struct KNamelist **list,
bool ( CC * f ) ( const KDirectory *dir, const char *name, void *data ),
void *data,
const char *path, va_list args ) const throw ()
{ return KDirectoryVList ( this, list, f, data, path, args ); }
/* Visit
* visit each path under designated directory
*
* "recurse" [ IN ] - if true, recursively visit sub-directories
*
* "f" [ IN ] and "data" [ IN, OPAQUE ] - function to execute
* on each path. receives a base directory and relative path
* for each entry. if "f" returns true, the iteration will
* terminate and that value will be returned. NB - "dir" will not
* be the same as "self".
*
* "path" [ IN ] - NUL terminated string in directory-native character set
*/
inline rc_t Visit ( bool recurse,
rc_t ( CC * f ) ( const KDirectory *dir, uint32_t type, const char *name, void *data ),
void *data,
const char *path, ... ) const throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVVisit ( this, recurse, f, data, path, args );
va_end ( args );
return rc;
}
inline rc_t Visit ( bool recurse,
rc_t ( CC * f ) ( const KDirectory *dir, uint32_t type, const char *name, void *data ),
void *data,
const char *path, va_list args ) const throw ()
{ return KDirectoryVVisit ( this, recurse, f, data, path, args ); }
/* VisitUpdate
* like Visit except that the directory passed back to "f"
* is available for update operations
*/
inline rc_t VisitUpdate ( bool recurse,
rc_t ( CC * f ) ( KDirectory *dir, uint32_t type, const char *name, void *data ),
void *data,
const char *path, ... ) throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVVisitUpdate ( this, recurse, f, data, path, args );
va_end ( args );
return rc;
}
inline rc_t VisitUpdate ( bool recurse,
rc_t ( CC * f ) ( KDirectory *dir, uint32_t type, const char *name, void *data ),
void *data,
const char *path, va_list args ) throw ()
{ return KDirectoryVVisitUpdate ( this, recurse, f, data, path, args ); }
/* PathType
* returns a KPathType
*
* "path" [ IN ] - NUL terminated string in directory-native character set
*/
inline uint32_t PathType ( const char *path, ... ) const throw ()
{
va_list args;
va_start ( args, path );
uint32_t r = KDirectoryVPathType ( this, path, args );
va_end ( args );
return r;
}
inline uint32_t PathType ( const char *path, va_list args ) const throw ()
{ return KDirectoryVPathType ( this, path, args ); }
/* ResolvePath
* resolves path to an absolute or directory-relative path
*
* "absolute" [ IN ] - if true, always give a path starting
* with '/'. NB - if the directory is chroot'd, the absolute path
* will still be relative to directory root.
*
* "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
* NUL terminated result path in directory-native character set
* the resolved path will be directory relative
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target path. NB - need not exist.
*/
inline rc_t ResolvePath ( bool absolute, char *resolved, size_t rsize,
const char *path, ... ) const throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVResolvePath ( this, absolute, resolved, rsize, path, args );
va_end ( args );
return rc;
}
inline rc_t ResolvePath ( bool absolute, char *resolved, size_t rsize,
const char *path, va_list args ) const throw ()
{ return KDirectoryVResolvePath ( this, absolute, resolved, rsize, path, args ); }
/* ResolveAlias
* resolves an alias path to its immediate target
* NB - the resolved path may be yet another alias
*
* "absolute" [ IN ] - if true, always give a path starting
* with '/'. NB - if the directory is chroot'd, the absolute path
* will still be relative to directory root.
*
* "resolved" [ OUT ] and "rsize" [ IN ] - buffer for
* NUL terminated result path in directory-native character set
* the resolved path will be directory relative
*
* "alias" [ IN ] - NUL terminated string in directory-native
* character set denoting an object presumed to be an alias.
*/
inline rc_t ResolveAlias ( bool absolute, char *resolved, size_t rsize,
const char *alias, ... ) const throw ()
{
va_list args;
va_start ( args, alias );
rc_t rc = KDirectoryVResolveAlias ( this, absolute, resolved, rsize, alias, args );
va_end ( args );
return rc;
}
inline rc_t ResolveAlias ( bool absolute, char *resolved, size_t rsize,
const char *alias, va_list args ) const throw ()
{ return KDirectoryVResolveAlias ( this, absolute, resolved, rsize, alias, args ); }
/* Rename
* rename an object accessible from directory, replacing
* any existing target object of the same type
*
* "from" [ IN ] - NUL terminated string in directory-native
* character set denoting existing object
*
* "to" [ IN ] - NUL terminated string in directory-native
* character set denoting existing object
*
* "force" [ IN ] - not false means try to do more if it fails internally
*/
inline rc_t Rename ( bool force, const char *from, const char *to ) throw ()
{ return KDirectoryRename ( this, force, from, to ); }
/* Remove
* remove an accessible object from its directory
*
* "force" [ IN ] - if true and target is a directory,
* remove recursively
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target object
*/
inline rc_t Remove ( bool force, const char *path, ... ) throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVRemove ( this, force, path, args );
va_end ( args );
return rc;
}
inline rc_t Remove ( bool force, const char *path, va_list args ) throw ()
{ return KDirectoryVRemove ( this, force, path, args ); }
/* ClearDir
* remove all directory contents
*
* "force" [ IN ] - if true and directory entry is a
* sub-directory, remove recursively
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target directory
*/
inline rc_t ClearDir ( bool force, const char *path, ... ) throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVClearDir ( this, force, path, args );
va_end ( args );
return rc;
}
inline rc_t ClearDir ( bool force, const char *path,
va_list args ) throw ()
{ return KDirectoryVClearDir ( this, force, path, args ); }
/* Access
* get access to object
*
* "access" [ OUT ] - return parameter for Unix access mode
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target object
*/
inline rc_t Access ( uint32_t *access,
const char *path, ... ) const throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVAccess ( this, access, path, args );
va_end ( args );
return rc;
}
inline rc_t Access ( uint32_t *access, const char *path,
va_list args ) const throw ()
{ return KDirectoryVAccess ( this, access, path, args ); }
/* SetAccess
* set access to object a la Unix "chmod"
*
* "recurse" [ IN ] - if non zero and "path" is a directory,
* apply changes recursively.
*
* "access" [ IN ] and "mask" [ IN ] - definition of change
* where "access" contains new bit values and "mask defines
* which bits should be changed.
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target object
*/
inline rc_t SetAccess ( bool recurse, uint32_t access, uint32_t mask,
const char *path, ... ) throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVSetAccess ( this, recurse, access, mask, path, args );
va_end ( args );
return rc;
}
inline rc_t SetAccess ( bool recurse, uint32_t access, uint32_t mask,
const char *path, va_list args ) throw ()
{ return KDirectoryVSetAccess ( this, recurse, access, mask, path, args ); }
/* Date
* get date/time to object
*
* "date" [ OUT ] - return parameter
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target object
*/
inline rc_t Date ( KTime_t *date, const char *path, ... ) const throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVDate ( this, date, path, args );
va_end ( args );
return rc;
}
inline rc_t Date ( KTime_t *date, const char *path,
va_list args ) const throw ()
{ return KDirectoryVDate ( this, date, path, args ); }
/* SetDate
* set date to object
*
* "recurse" [ IN ] - if non zero and "path" is a directory,
* apply changes recursively.
*
* "date" [ IN ] - new time and date for the object
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target object
*/
inline rc_t SetDate ( bool recurse, KTime_t date,
const char *path, ... ) throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVSetDate ( this, recurse, date, path, args );
va_end ( args );
return rc;
}
inline rc_t SetDate ( bool recurse, KTime_t date, const char *path,
va_list args ) throw ()
{ return KDirectoryVSetDate ( this, recurse, date, path, args ); }
/* CreateAlias
* creates a path alias according to create mode
*
* "access" [ IN ] - standard Unix directory access mode
* used when "mode" has kcmParents set and alias path does
* not exist.
*
* "mode" [ IN ] - a creation mode ( see explanation above ).
*
* "targ" [ IN ] - NUL terminated string in directory-native
* character set denoting target object
*
* "alias" [ IN ] - NUL terminated string in directory-native
* character set denoting target alias
*/
inline rc_t CreateAlias ( uint32_t access, KCreateMode mode,
const char *targ, const char *alias ) throw ()
{ return KDirectoryCreateAlias ( this, access, mode, targ, alias ); }
/* OpenFileRead
* opens an existing file with read-only access
*
* "f" [ OUT ] - return parameter for newly opened file
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target file
*/
inline rc_t OpenFileRead ( struct KFile const **f,
const char *path, ... ) const throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVOpenFileRead ( this, f, path, args );
va_end ( args );
return rc;
}
inline rc_t OpenFileRead ( struct KFile const **f, const char *path,
va_list args ) const throw ()
{ return KDirectoryVOpenFileRead ( this, f, path, args ); }
/* OpenFileWrite
* opens an existing file with write access
*
* "f" [ OUT ] - return parameter for newly opened file
*
* "update" [ IN ] - if true, open in read/write mode
* otherwise, open in write-only mode
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target file
*/
inline rc_t OpenFileWrite ( struct KFile **f, bool update,
const char *path, ... ) throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVOpenFileWrite ( this, f, update, path, args );
va_end ( args );
return rc;
}
inline rc_t OpenFileWrite ( struct KFile **f, bool update,
const char *path, va_list args ) throw ()
{ return KDirectoryVOpenFileWrite ( this, f, update, path, args ); }
/* CreateFile
* opens a file with write access
*
* "f" [ OUT ] - return parameter for newly opened file
*
* "update" [ IN ] - if true, open in read/write mode
* otherwise, open in write-only mode
*
* "access" [ IN ] - standard Unix access mode, e.g. 0664
*
* "mode" [ IN ] - a creation mode ( see explanation above ).
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target file
*/
inline rc_t CreateFile ( struct KFile **f, bool update, uint32_t access,
KCreateMode mode, const char *path, ... ) throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVCreateFile ( this, f, update, access, mode, path, args );
va_end ( args );
return rc;
}
inline rc_t CreateFile ( struct KFile **f, bool update, uint32_t access,
KCreateMode mode, const char *path, va_list args ) throw ()
{ return KDirectoryVCreateFile ( this, f, update, access, mode, path, args ); }
/* FileSize
* returns size in bytes of target file
*
* "size" [ OUT ] - return parameter for file size
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target file
*/
inline rc_t FileSize ( uint64_t *size,
const char *path, ... ) const throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVFileSize ( this, size, path, args );
va_end ( args );
return rc;
}
inline rc_t FileSize ( uint64_t *size, const char *path,
va_list args ) const throw ()
{ return KDirectoryVFileSize ( this, size, path, args ); }
/* SetFileSize
* sets size in bytes of target file
*
* "size" [ IN ] - new file size
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target file
*/
inline rc_t SetFileSize ( uint64_t size, const char *path, ... ) throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVSetFileSize ( this, size, path, args );
va_end ( args );
return rc;
}
inline rc_t SetFileSize ( uint64_t size, const char *path,
va_list args ) throw ()
{ return KDirectoryVSetFileSize ( this, size, path, args ); }
/* OpenDirRead
* OpenDirUpdate
* opens a sub-directory
*
* "chroot" [ IN ] - if true, the new directory becomes
* chroot'd and will interpret paths beginning with '/'
* relative to itself.
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target directory
*/
inline rc_t OpenDirRead ( const KDirectory **sub, bool chroot,
const char *path, ... ) const throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVOpenDirRead ( this, sub, chroot, path, args );
va_end ( args );
return rc;
}
inline rc_t OpenDirRead ( const KDirectory **sub, bool chroot,
const char *path, va_list args ) const throw ()
{ return KDirectoryVOpenDirRead ( this, sub, chroot, path, args ); }
inline rc_t OpenDirUpdate ( KDirectory **sub, bool chroot,
const char *path, ... )
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVOpenDirUpdate ( this, sub, chroot, path, args );
va_end ( args );
return rc;
}
inline rc_t OpenDirUpdate ( KDirectory **sub, bool chroot,
const char *path, va_list args ) throw ()
{ return KDirectoryVOpenDirUpdate ( this, sub, chroot, path, args ); }
/* CreateDir
* create a sub-directory
*
* "access" [ IN ] - standard Unix directory mode, e.g.0775
*
* "mode" [ IN ] - a creation mode ( see explanation above ).
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target directory
*/
inline rc_t CreateDir ( uint32_t access, KCreateMode mode,
const char *path, ... ) throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = KDirectoryVCreateDir ( this, access, mode, path, args );
va_end ( args );
return rc;
}
inline rc_t CreateDir ( uint32_t access, KCreateMode mode,
const char *path, va_list args ) throw ()
{ return KDirectoryVCreateDir ( this, access, mode, path, args ); }
/* NativeDir
* returns a native file-system directory node reference
* the directory root will be "/" and set to the native
* idea of current working directory
*
* NB - the returned reference will be non-const, allowing
* modification operations to be attempted. these operations
* may still fail if the underlying FS disallows them.
*
* "dir" [ OUT ] - return parameter for native directory
*/
inline static rc_t NativeDir ( KDirectory **dir ) throw ()
{ return KDirectoryNativeDir ( dir ); }
private:
KDirectory ();
~ KDirectory ();
KDirectory ( const KDirectory& );
KDirectory &operator = ( const KDirectory& );
};
#endif /* _hpp_kfs_directory_ */
sra_sdk-2.1.7/interfaces/kfs/dyload.h 0000644 0012213 0011620 00000013772 11476747550 017220 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_dyload_
#define _h_kfs_dyload_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#include
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KDirectory;
/*--------------------------------------------------------------------------
* KDyld
* dynamic library loader
*
* maintains cache of libraries it has opened while they remain open
* such that subsequent requests for an open library will return a
* new reference to the existing library.
*/
typedef struct KDyld KDyld;
/* Make
* create a dynamic loader object
*
* "dl" [ OUT ] - return parameter for loader
*/
KFS_EXTERN rc_t CC KDyldMake ( KDyld **dl );
/* AddRef
* Release
*/
KFS_EXTERN rc_t CC KDyldAddRef ( const KDyld *self );
KFS_EXTERN rc_t CC KDyldRelease ( const KDyld *self );
/* AddSearchPath
* add a search path to loader for locating library files
*/
KFS_EXTERN rc_t CC KDyldAddSearchPath ( KDyld *self, const char *path, ... );
KFS_EXTERN rc_t CC KDyldVAddSearchPath ( KDyld *self, const char *path, va_list args );
/* HomeDirectory
* returns a KDirectory where the binary for a given function is located
*
* "dir" [ OUT ] - return parameter for home directory ( read-only ), if found
*
* "func" [ IN ] - function pointer within binary to be located
*/
KFS_EXTERN rc_t CC KDyldHomeDirectory ( const KDyld *self,
struct KDirectory const **dir, fptr_t func );
/*--------------------------------------------------------------------------
* KDylib
* dynamic library
*/
typedef struct KDylib KDylib;
/* LoadLib
* load a dynamic library
*
* "lib" [ OUT ] - return parameter for loaded library
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target library
*/
KFS_EXTERN rc_t CC KDyldLoadLib ( KDyld *self,
KDylib **lib, const char *path, ... );
KFS_EXTERN rc_t CC KDyldVLoadLib ( KDyld *self,
KDylib **lib, const char *path, va_list args );
/* AddRef
* Release
*/
KFS_EXTERN rc_t CC KDylibAddRef ( const KDylib *self );
KFS_EXTERN rc_t CC KDylibRelease ( const KDylib *self );
/* FullPath
* return full path to library
*/
KFS_EXTERN rc_t CC KDylibFullPath ( const KDylib *self, char *path, size_t psize );
/*--------------------------------------------------------------------------
* KDlset
* set of dynamic libraries
* contained libraries remain resident until set is released
*/
typedef struct KDlset KDlset;
/* MakeSet
* load a dynamic library
*
* "set" [ OUT ] - return parameter for lib set
*/
KFS_EXTERN rc_t CC KDyldMakeSet ( const KDyld *self, KDlset **set );
/* AddRef
* Release
*/
KFS_EXTERN rc_t CC KDlsetAddRef ( const KDlset *self );
KFS_EXTERN rc_t CC KDlsetRelease ( const KDlset *self );
/* AddLib
* adds a dynamic library to set
* returns "rcExists" error if already present
*
* "lib" [ IN ] - library returned from KDyldLoadLib
*/
KFS_EXTERN rc_t CC KDlsetAddLib ( KDlset *self, KDylib *lib );
/* AddAll
* adds all dynamic libraries found in dl search path
*/
KFS_EXTERN rc_t CC KDlsetAddAll ( KDlset *self );
/*--------------------------------------------------------------------------
* KSymAddr
* symbol address within a dynamic library
*/
typedef struct KSymAddr KSymAddr;
/* Symbol
* find a symbol within dynamic library
*
* "sym" [ OUT ] - return parameter for exported symbol address
*
* "name" [ IN ] - NUL terminated symbol name in
* library-native character set
*/
KFS_EXTERN rc_t CC KDylibSymbol ( const KDylib *self, KSymAddr **sym, const char *name );
KFS_EXTERN rc_t CC KDlsetSymbol ( const KDlset *self, KSymAddr **sym, const char *name );
/* FirstSymbol
* LastSymbol
* find a symbol within dynamic library set matching criteria
*
* "sym" [ OUT ] - return parameter for exported symbol address
*
* "name" [ IN ] - NUL terminated symbol name in
* library-native character set
*
* "test" [ IN ] and "data" [ IN, OPAQUE ] - callback filter function
* return true if symbol matches criteria
*/
KFS_EXTERN rc_t CC KDlsetFirstSymbol ( const KDlset *self, KSymAddr **sym, const char *name,
bool ( CC * test ) ( const KSymAddr *sym, void *data ), void *data );
KFS_EXTERN rc_t CC KDlsetLastSymbol ( const KDlset *self, KSymAddr **sym, const char *name,
bool ( CC * test ) ( const KSymAddr *sym, void *data ), void *data );
/* AddRef
* Release
*/
KFS_EXTERN rc_t CC KSymAddrAddRef ( const KSymAddr *self );
KFS_EXTERN rc_t CC KSymAddrRelease ( const KSymAddr *self );
/* AsObj
* AsFunc
* retrieve symbol address as pointer to object
*/
KFS_EXTERN void *CC KSymAddrAsObj ( const KSymAddr *self );
KFS_EXTERN void CC KSymAddrAsFunc ( const KSymAddr *self, fptr_t *fp );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_dyload_ */
sra_sdk-2.1.7/interfaces/kfs/file.h 0000644 0012213 0011620 00000010144 11476747550 016651 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_file_
#define _h_kfs_file_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* KFileDesc
* describes basic file types
*/
enum KFileDesc
{
kfdNull,
kfdInvalid,
kfdFile,
kfdCharDev,
kfdBlockDev,
kfdFIFO,
kfdSocket,
/* the type enum may be extended */
kfdLastDefined
};
/*--------------------------------------------------------------------------
* KFile
* a file is normally created with a KDirectory
* optionally, the 3 standard i/o files may be created directly
*/
typedef struct KFile KFile;
/* AddRef
* Release
* ignores NULL references
*/
KFS_EXTERN rc_t CC KFileAddRef ( const KFile *self );
KFS_EXTERN rc_t CC KFileRelease ( const KFile *self );
/* RandomAccess
* ALMOST by definition, the file is random access
*
* certain file types will refuse random access
* these include FIFO and socket based files, but also
* wrappers that require serial access ( e.g. compression )
*
* returns 0 if random access, error code otherwise
*/
KFS_EXTERN rc_t CC KFileRandomAccess ( const KFile *self );
/* Type
* returns a KFileDesc
* not intended to be a content type,
* but rather an implementation class
*/
KFS_EXTERN uint32_t CC KFileType ( const KFile *self );
/* Size
* returns size in bytes of file
*
* "size" [ OUT ] - return parameter for file size
*/
KFS_EXTERN rc_t CC KFileSize ( const KFile *self, uint64_t *size );
/* SetSize
* sets size in bytes of file
*
* "size" [ IN ] - new file size
*/
KFS_EXTERN rc_t CC KFileSetSize ( KFile *self, uint64_t size );
/* Read
* read file from known position
*
* "pos" [ IN ] - starting position within file
*
* "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
*
* "num_read" [ OUT ] - return parameter giving number of bytes
* actually read. when returned value is zero and return code is
* also zero, interpreted as end of file.
*/
KFS_EXTERN rc_t CC KFileRead ( const KFile *self, uint64_t pos,
void *buffer, size_t bsize, size_t *num_read );
/* Write
* write file at known position
*
* "pos" [ IN ] - starting position within file
*
* "buffer" [ IN ] and "size" [ IN ] - data to be written
*
* "num_writ" [ OUT, NULL OKAY ] - optional return parameter
* giving number of bytes actually written
*/
KFS_EXTERN rc_t CC KFileWrite ( KFile *self, uint64_t pos,
const void *buffer, size_t size, size_t *num_writ );
/* MakeStdIn
* creates a read-only file on stdin
*/
KFS_EXTERN rc_t CC KFileMakeStdIn ( const KFile **std_in );
/* MakeStdOut
* MakeStdErr
* creates a write-only file on stdout or stderr
*/
KFS_EXTERN rc_t CC KFileMakeStdOut ( KFile **std_out );
KFS_EXTERN rc_t CC KFileMakeStdErr ( KFile **std_err );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_file_ */
sra_sdk-2.1.7/interfaces/kfs/file.hpp 0000644 0012213 0011620 00000011075 11520072536 017176 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _hpp_kfs_file_
#define _hpp_kfs_file_
#ifndef _h_kfs_file_
#include
#endif
//#include // KFileMakeMd5ForReadFromString
/*--------------------------------------------------------------------------
* KFile
* a file
*/
struct KFile
{
/* AddRef
* Release
* ignores NULL references
*/
inline rc_t AddRef () const throw ()
{ return KFileAddRef ( this ); }
inline rc_t Release () const throw ()
{ return KFileRelease ( this ); }
/* RandomAccess
* ALMOST by definition, the file is random access
*
* certain file types will refuse random access
* these include FIFO and socket based files, but also
* wrappers that require serial access ( e.g. compression )
*
* returns 0 if random access, error code otherwise
*/
inline rc_t RandomAccess () const throw()
{ return KFileRandomAccess ( this ); }
/* Type
* returns a KFileDesc
* not intended to be a content type,
* but rather an implementation class
*/
inline uint32_t FileType() const throw()
{ return KFileType ( this ); }
/* Size
* returns size in bytes of file
*
* "size" [ OUT ] - return parameter for file size
*/
inline rc_t Size ( uint64_t *size ) const throw ()
{ return KFileSize ( this, size ); }
/* SetSize
* sets size in bytes of file
*
* "size" [ IN ] - new file size
*/
inline rc_t SetSize ( uint64_t size ) throw ()
{ return KFileSetSize ( this, size ); }
/* Read
* read file from known position
*
* "pos" [ IN ] - starting position within file
*
* "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read
*
* "num_read" [ OUT ] - return parameter giving number of bytes
* actually read. when returned value is zero and return code is
* also zero, interpreted as end of file.
*/
inline rc_t Read ( uint64_t pos,
void *buffer, size_t bsize, size_t *num_read ) const throw ()
{ return KFileRead ( this, pos, buffer, bsize, num_read ); }
/* Write
* write file at known position
*
* "pos" [ IN ] - starting position within file
*
* "buffer" [ IN ] and "size" [ IN ] - data to be written
*
* "num_writ" [ OUT, NULL OKAY ] - optional return parameter
* giving number of bytes actually written
*/
inline rc_t Write ( uint64_t pos,
const void *buffer, size_t size, size_t *num_writ ) throw ()
{ return KFileWrite ( this, pos, buffer, size, num_writ ); }
/* MakeStdIn
* creates a read-only file on stdin
*/
static inline rc_t MakeStdIn ( const KFile **std_in ) throw ()
{ return KFileMakeStdIn ( std_in ); }
/* MakeStdOut
* MakeStdErr
* creates a write-only file on stdout or stderr
*/
static inline rc_t MakeStdOut ( KFile **std_out ) throw ()
{ return KFileMakeStdOut ( std_out ); }
static inline rc_t MakeStdErr ( KFile **std_err ) throw ()
{ return KFileMakeStdErr ( std_err ); }
/*/ MD5
static inline rc_t MakeMd5ForRead ( const KFile **f,
const KFile *src, const char digest[MD5_DIGEST_SIZE] )
{ return KFileMakeMd5ForReadFromString ( f, src, digest ); }*/
private:
KFile ();
~ KFile ();
KFile ( const KFile& );
KFile &operator = ( const KFile& );
};
#endif // _hpp_kfs_file_
sra_sdk-2.1.7/interfaces/kfs/fileformat.h 0000644 0012213 0011620 00000011707 11476747550 020070 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_fileformat_
#define _h_kfs_fileformat_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct KDirectory;
/*
* Multiple descriptions can be attached to a single key.
* At most one key can be attached to a single description.
*
* Multiple types can be attached to a single class.
* At most one class can be attached to a single type.
*/
/*--------------------------------------------------------------------------
* KFileFormatType
* describes basic file content types. The type can be used to choose what
* parser is used to extract information for a loader, archive as filesystem,
* or decompress for further parsing.
*/
typedef
int32_t KFileFormatType;
enum KFileFormatType_e
{
kfftError = -2, /* A file that can not be read for typing */
kfftNotFound = -1, /* not found in a search */
kfftUnknown = 0 /* not yet or file format not understood. */
/* other types are registered during construction **?** */
};
/* -------------------------------------------------------------------------
* KFileFormatClass
* Describes which class of operations can be performed in a given file.
* Unknown: nothing in particular
* Compressed: decompressed to reveal different expanded file contents
* Archive: treated as a file system to reach contained files
* Run: loaded into the SRA DB
*/
typedef
int32_t KFileFormatClass;
enum KFileFormatClass_e
{
kffcError = -2, /* A file that can not be read for typing */
kffcNotFound = -1, /* not found in a search */
kffcUnknown = 0 /* not yet or file format not understood. */
};
/*--------------------------------------------------------------------------
* KFileFormat
*/
typedef struct KFileFormat KFileFormat;
/* AddRef
* Release
* ignores NULL references
*/
KFS_EXTERN rc_t CC KFileFormatAddRef (const KFileFormat *self);
KFS_EXTERN rc_t CC KFileFormatRelease (const KFileFormat *self);
/* Type
* intended to be a content type,
* if type, class or desc is NULL those types are not returned
*/
KFS_EXTERN rc_t CC KFileFormatGetTypeBuff (const KFileFormat *self, const void * buff, size_t buff_len,
KFileFormatType * type, KFileFormatClass * class,
char * description, size_t descriptionmax,
size_t * length);
#define KFileFormatGetTypeBuffType(self,buff,buff_len,type) \
KFileFormatGetTypeBuff(self,buff,buff_len,type,NULL,NULL,0,NULL)
#define KFileFormatGetTypeBuffClass(self,buff,buff_len,class) \
KFileFormatGetTypeBuff(self,buff,buff_len,NULL,class,NULL,0,NULL)
/* useful for logging perhaps */
#define KFileFormatGetTypeBuffDescr(self,buff,buff_len,descr,descr_max,descr_len) \
KFileFormatGetTypeBuff(self,buff,buff_len,NULL,NULL,descr,descr_max,descr_len)
KFS_EXTERN rc_t CC KFileFormatGetTypePath(const KFileFormat *self, const struct KDirectory * dir,
const char * path, KFileFormatType * type,
KFileFormatClass * class, char * description,
size_t descriptionmax, size_t * length);
#define KFileFormatGetTypePathType(self,dir,path,type) \
KFileFormatGetTypePath(self,dir,path,type,NULL,NULL,0,NULL)
#define KFileFormatGetTypePathClass(self,dir,path,class) \
KFileFormatGetTypePath(self,dir,path,NULL,class,NULL,0,NULL)
/* useful for logging perhaps */
#define KFileFormatGetTypePathDescr(self,dir,path,descr,descr_max,descr_len) \
KFileFormatGetTypePath(self,dir,path,NULL,NULL,descr,descr_max,descr_len)
KFS_EXTERN rc_t CC KFileFormatGetClassDescr (const KFileFormat *self, KFileFormatClass c,
char * description, size_t descriptionmax);
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_fileformat_ */
sra_sdk-2.1.7/interfaces/kfs/gzip.h 0000644 0012213 0011620 00000004565 11476747550 016715 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_gzip_
#define _h_kfs_gzip_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KFile;
/* MakeGzipForRead
* creates an adapter to gunzip a source file
*
* "gz" [ OUT ] - return parameter for decompressed file
*
* "src" [ IN ] - compressed source file with read permission
*
* NB - creates a read-only file that does NOT support random access
* i.e. must be consumed serially starting from offset 0
*/
KFS_EXTERN rc_t CC KFileMakeGzipForRead ( struct KFile const **gz, struct KFile const *src );
/* MakeGzipForWrite
* creates an adapter to gzip a source file
*
* "gz" [ OUT ] - return parameter for compressed file
*
* "src" [ IN ] - uncompressed source file with write permission
*
* NB - creates a write-only file that does NOT suppport random access
* i.e. must be written serially from offset 0
*/
KFS_EXTERN rc_t CC KFileMakeGzipForWrite ( struct KFile **gz, struct KFile *file );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_gzip_ */
sra_sdk-2.1.7/interfaces/kfs/impl.h 0000644 0012213 0011620 00000024642 11576721672 016701 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_impl_
#define _h_kfs_impl_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_kfs_file_
#include
#endif
#ifndef _h_kfs_directory_
#include
#endif
#ifndef _h_kfs_arrayfile_
#include
#endif
#ifndef _h_klib_refcount_
#include
#endif
#ifndef _h_klib_namelist_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KBufFile;
struct KSysDir;
struct KSysFile;
typedef union KFile_vt KFile_vt;
typedef union KDirectory_vt KDirectory_vt;
/*--------------------------------------------------------------------------
* KFile
* a virtual file
*/
struct KFile
{
const KFile_vt *vt;
const KDirectory *dir;
atomic32_t refcount;
uint8_t read_enabled;
uint8_t write_enabled;
uint8_t align [ 2 ];
};
#ifndef KFILE_IMPL
#define KFILE_IMPL struct KFile
#endif
typedef struct KFile_vt_v1 KFile_vt_v1;
struct KFile_vt_v1
{
/* version == 1.x */
uint32_t maj;
uint32_t min;
/* start minor version == 0 */
rc_t ( CC * destroy ) ( KFILE_IMPL *self );
struct KSysFile* ( CC * get_sysfile ) ( const KFILE_IMPL *self, uint64_t *offset );
rc_t ( CC * random_access ) ( const KFILE_IMPL *self );
rc_t ( CC * get_size ) ( const KFILE_IMPL *self, uint64_t *size );
rc_t ( CC * set_size ) ( KFILE_IMPL *self, uint64_t size );
/* num_read and num_writ are guaranteed non-NULL */
rc_t ( CC * read ) ( const KFILE_IMPL *self, uint64_t pos,
void *buffer, size_t bsize, size_t *num_read );
rc_t ( CC * write ) ( KFILE_IMPL *self, uint64_t pos,
const void *buffer, size_t size, size_t *num_writ );
/* end minor version == 0 */
/* start minor version == 1 */
uint32_t ( CC * get_type ) ( const KFILE_IMPL * self );
/* end minor version == 1 */
/* ANY NEW ENTRIES MUST BE REFLECTED IN libs/kfs/file.c
BY BOTH THE CORRESPONDING MESSAGE DISPATCH FUNCTION(s) AND
VTABLE VALIDITY CHECKS IN KFileInit */
};
union KFile_vt
{
KFile_vt_v1 v1;
};
/* Init
* initialize a newly allocated file object
*/
KFS_EXTERN rc_t CC KFileInit ( KFile *self, const KFile_vt *vt,
bool read_enabled, bool write_enabled );
/* Destroy
* destroy file
*/
KFS_EXTERN rc_t CC KFileDestroy ( KFile *self );
/* GetSysFile
* returns an underlying system file object
* and starting offset to contiguous region
* suitable for memory mapping, or NULL if
* no such file is available.
*/
KFS_EXTERN struct KSysFile* CC KFileGetSysFile ( const KFile *self, uint64_t *offset );
/*--------------------------------------------------------------------------
* KDirectory
* a virtual directory
*/
struct KDirectory
{
const KDirectory_vt *vt;
KRefcount refcount;
uint8_t read_only;
uint8_t align [ 3 ];
};
#ifndef KDIR_IMPL
#define KDIR_IMPL KDirectory
#endif
typedef struct KDirectory_vt_v1 KDirectory_vt_v1;
struct KDirectory_vt_v1
{
/* version == 1.x */
uint32_t maj;
uint32_t min;
/* start minor version == 0 */
rc_t ( CC * destroy ) ( KDIR_IMPL *self );
rc_t ( CC * list_dir ) ( const KDIR_IMPL *self, struct KNamelist **list,
bool ( CC * f ) ( const KDirectory *dir, const char *name, void *data ),
void *data, const char *path, va_list args );
rc_t ( CC * visit ) ( const KDIR_IMPL *self, bool recurse,
rc_t ( CC * f ) ( const KDirectory*, uint32_t, const char*, void* ),
void *data, const char *path, va_list args );
rc_t ( CC * visit_update ) ( KDIR_IMPL *self, bool recurse,
rc_t ( CC * f ) ( KDirectory*, uint32_t, const char*, void* ),
void *data, const char *path, va_list args );
uint32_t ( CC * path_type ) ( const KDIR_IMPL *self, const char *path, va_list args );
rc_t ( CC * resolve_path ) ( const KDIR_IMPL *self, bool absolute,
char *resolved, size_t rsize, const char *path, va_list args );
rc_t ( CC * resolve_alias ) ( const KDIR_IMPL *self, bool absolute,
char *resolved, size_t rsize, const char *alias, va_list args );
rc_t ( CC * rename ) ( KDIR_IMPL *self, bool force, const char *from, const char *to );
rc_t ( CC * remove ) ( KDIR_IMPL *self, bool force, const char *path, va_list args );
rc_t ( CC * clear_dir ) ( KDIR_IMPL *self, bool force, const char *path, va_list args );
rc_t ( CC * access ) ( const KDIR_IMPL *self,
uint32_t *access, const char *path, va_list args );
rc_t ( CC * set_access ) ( KDIR_IMPL *self, bool recurse,
uint32_t access, uint32_t mask, const char *path, va_list args );
rc_t ( CC * create_alias ) ( KDIR_IMPL *self, uint32_t access,
KCreateMode mode, const char *targ, const char *alias );
rc_t ( CC * open_file_read ) ( const KDIR_IMPL *self,
const KFile **f, const char *path, va_list args );
rc_t ( CC * open_file_write ) ( KDIR_IMPL *self,
KFile **f, bool update, const char *path, va_list args );
rc_t ( CC * create_file ) ( KDIR_IMPL *self, KFile **f, bool update,
uint32_t access, KCreateMode mode, const char *path, va_list args );
rc_t ( CC * file_size ) ( const KDIR_IMPL *self,
uint64_t *size, const char *path, va_list args );
rc_t ( CC * set_size ) ( KDIR_IMPL *self,
uint64_t size, const char *path, va_list args );
rc_t ( CC * open_dir_read ) ( const KDIR_IMPL *self,
const KDirectory **sub, bool chroot, const char *path, va_list args );
rc_t ( CC * open_dir_update ) ( KDIR_IMPL *self,
KDirectory **sub, bool chroot, const char *path, va_list args );
rc_t ( CC * create_dir ) ( KDIR_IMPL *self, uint32_t access,
KCreateMode mode, const char *path, va_list args );
/* optional destructor method - leave NULL if not needed */
rc_t ( CC * destroy_file ) ( KDIR_IMPL *self, KFile *f );
/* end minor version == 0 */
/* start minor version == 1 */
rc_t ( CC * date ) ( const KDIR_IMPL *self,
KTime_t * date, const char *path, va_list args );
rc_t ( CC * setdate ) ( KDIR_IMPL * self, bool recurse,
KTime_t date, const char *path, va_list args );
struct KSysDir* ( CC * get_sysdir ) ( const KDIR_IMPL *self );
/* end minor version == 1 */
/* start minor version == 2 */
rc_t ( CC * file_locator ) ( const KDIR_IMPL *self,
uint64_t *locator, const char *path, va_list args );
/* end minor version == 2 */
/* start minor version == 3 */
rc_t ( CC * file_phys_size ) ( const KDIR_IMPL *self,
uint64_t *phys_size, const char *path, va_list args );
rc_t ( CC * file_contiguous ) ( const KDIR_IMPL *self,
bool *contiguous, const char *path, va_list args );
/* end minor version == 3 */
/* ANY NEW ENTRIES MUST BE REFLECTED IN libs/kfs/directory.c
BY BOTH THE CORRESPONDING MESSAGE DISPATCH FUNCTION(s) AND
VTABLE VALIDITY CHECKS IN KDirectoryInit */
};
union KDirectory_vt
{
KDirectory_vt_v1 v1;
};
/* Init
* initialize a newly allocated directory object
*/
KFS_EXTERN rc_t CC KDirectoryInit ( KDirectory *self, const KDirectory_vt *vt,
const char * class_name, const char * path, bool update );
/* DestroyFile
* does whatever is necessary with an unreferenced file
*/
KFS_EXTERN rc_t CC KDirectoryDestroyFile ( const KDirectory *self, KFile *f );
/* GetSysDir
* returns an underlying system file object
*/
KFS_EXTERN struct KSysDir* CC KDirectoryGetSysDir ( const KDirectory *self );
/*--------------------------------------------------------------------------
* KArrayFile
* an array-file is created from a KFile
*/
typedef union KArrayFile_vt KArrayFile_vt;
struct KArrayFile
{
const KArrayFile_vt *vt;
KRefcount refcount;
uint8_t read_enabled;
uint8_t write_enabled;
uint8_t align [ 2 ];
};
#ifndef KARRAYFILE_IMPL
#define KARRAYFILE_IMPL KArrayFile
#endif
typedef struct KArrayFile_vt_v1 KArrayFile_vt_v1;
struct KArrayFile_vt_v1
{
/* version number */
uint32_t maj, min;
/* start minor version == 0 */
rc_t ( CC * destroy ) ( KARRAYFILE_IMPL *self );
rc_t ( CC * dimensionality ) ( const KARRAYFILE_IMPL *self, uint8_t *dim );
rc_t ( CC * set_dimensionality ) ( KARRAYFILE_IMPL *self, uint8_t dim );
rc_t ( CC * dim_extents ) ( const KARRAYFILE_IMPL *self, uint8_t dim, uint64_t *extents );
rc_t ( CC * set_dim_extents ) ( KARRAYFILE_IMPL *self, uint8_t dim, uint64_t *extents );
rc_t ( CC * element_size ) ( const KARRAYFILE_IMPL *self, uint64_t *elem_bits );
rc_t ( CC * read ) ( const KARRAYFILE_IMPL *self, uint8_t dim,
const uint64_t *pos, void *buffer, const uint64_t *elem_count,
uint64_t *num_read );
rc_t ( CC * write ) ( KARRAYFILE_IMPL *self, uint8_t dim,
const uint64_t *pos, const void *buffer, const uint64_t *elem_count,
uint64_t *num_writ );
rc_t ( CC * get_meta ) ( const KARRAYFILE_IMPL *self, const char *key,
const KNamelist **list );
/* end minor version == 0 */
};
union KArrayFile_vt
{
KArrayFile_vt_v1 v1;
};
/* Init
* initialize a newly allocated array-file object
*/
KFS_EXTERN rc_t CC KArrayFileInit ( KArrayFile *self, const KArrayFile_vt *vt,
bool read_enabled, bool write_enabled );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_impl_ */
sra_sdk-2.1.7/interfaces/kfs/md5.h 0000644 0012213 0011620 00000021463 11476747550 016425 0 ustar rodarmer trace /*=======================================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_md5_
#define _h_kfs_md5_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KFile;
/*--------------------------------------------------------------------------
* KMD5SumFmt
* a formatter for reading or writing an md5sum-style checksum file
*/
typedef struct KMD5SumFmt KMD5SumFmt;
/* AddRef
* Release
*/
KFS_EXTERN rc_t CC KMD5SumFmtAddRef ( const KMD5SumFmt *self );
KFS_EXTERN rc_t CC KMD5SumFmtRelease ( const KMD5SumFmt *self );
/* Make
* creates a formatted accessor to textual checksum file
* takes over ownership of "in"/"out" file reference
*
* "in" [ IN ] - readable checksum input file
* -OR-
* "out" [ IN ] - writable checksum file. if readable as well,
* its contents will be preserved.
*/
KFS_EXTERN rc_t CC KMD5SumFmtMakeRead ( const KMD5SumFmt **f, struct KFile const *in );
KFS_EXTERN rc_t CC KMD5SumFmtMakeUpdate ( KMD5SumFmt **f, struct KFile *out );
/* Count
* return the number of checksums in file
*/
KFS_EXTERN rc_t CC KMD5SumFmtCount ( const KMD5SumFmt *self, uint32_t *count );
/* Get
* retrieve an indexed checksum line
*
* "idx" [ IN ] - zero-based index of checksum to access
*
* "path" [ OUT ] and "size" [ IN ] - return buffer for file path
*
* "digest" [ OUT ] - return parameter for the MD5 checksum
*
* "bin" [ OUT, NULL OKAY ] - true if fopen mode used to
* calculate "digest" was binary, false if text. pertinent if
* digest was calculated using DOS text mode.
*/
KFS_EXTERN rc_t CC KMD5SumFmtGet ( const KMD5SumFmt *self, uint32_t idx,
char *path, size_t size, uint8_t digest [ 16 ], bool *bin );
/* Find
* retrieve checksum line by path
*
* "path" [ IN ] - NUL terminated string in OS-native char set
* denoting path to file
*
* "digest" [ OUT ] - return parameter for the MD5 checksum
*
* "bin" [ OUT, NULL OKAY ] - true if fopen mode used to
* calculate "digest" was binary, false if text. pertinent if
* digest was calculated using DOS text mode.
*/
KFS_EXTERN rc_t CC KMD5SumFmtFind ( const KMD5SumFmt *self,
const char *path, uint8_t digest [ 16 ], bool *bin );
/* Delete
* remove an existing line
*
* "path" [ IN ] - NUL terminated string in OS-native char set
* denoting path to file
*
* returns rcNotFound if not present
*/
KFS_EXTERN rc_t CC KMD5SumFmtDelete ( KMD5SumFmt *self, const char *path );
/* Update
* add a checksum line to file or update an existing line
*
* "path" [ IN ] - NUL terminated string in OS-native char set
* denoting path to file
*
* "digest" [ IN ] - calculated MD5 checksum
*
* "bin" [ IN ] - true if checksum was calculated on all bytes
* in file, false if fopen mode used to read file was text.
*
* NB - the md5sum tool operates with the assumption that files
* are opened using "fopen". it records the mode used by prepending
* '*' to indicate binary and ' ' to indicate text mode within the
* checksum line.
*
* unfortunately, this creates a situation where text-mode files
* checksummed on DOS cannot be properly checked on any other
* platform without the aid of some filter to drop out '\r' from
* a '\r\n' sequence.
*
* fortunately, most users are unaware of the binary/text mode
* switches available with md5sum and use the default mode, which
* is binary on DOS and text on Unix, which happens to be equivalent
* to binary ( making one wonder why binary is not instead the
* universal default ).
*
* the end result is that we need to indicate whether CR stripping
* was performed while at the same time behaving like md5sum.
*/
KFS_EXTERN rc_t CC KMD5SumFmtUpdate ( KMD5SumFmt *self, const char *path,
const uint8_t digest [ 16 ], bool bin );
/* Rename
* Rename the checksum line to reflect a file name change but no content change.
*
* "newpath" [ IN ] - NUL terminated string in OS-native char set
* denoting path to file's new name
*
* "oldpath" [ IN ] - NUL terminated string in OS-native char set
* denoting path to file's old name
*
* Parameter order matches KDirectoryRename()
*/
KFS_EXTERN rc_t CC KMD5SumFmtRename ( KMD5SumFmt *self, const char *oldpath, const char *newpath );
/* Flush
* write data to disk, but stay open
*/
KFS_EXTERN rc_t CC KMD5SumFmtFlush ( KMD5SumFmt *self );
/*--------------------------------------------------------------------------
* MD5 KFile extensions
*/
/* MakeMD5Read
* creates an adapter to check MD5 checksum for a source file
*
* "f" [ OUT ] - return parameter for file with md5 check
*
* "src" [ IN ] - source file with read permission
*
* "digest" [ IN ] - MD5 checksum to match
*
* NB - creates a read-only file that does NOT support random access
* i.e. must be consumed serially starting from offset 0
*/
KFS_EXTERN rc_t CC KFileMakeMD5Read ( struct KFile const **f,
struct KFile const *src, const uint8_t digest [ 16 ] );
/*--------------------------------------------------------------------------
* KMD5File
* subclass of KFile
*/
typedef struct KMD5File KMD5File;
/* MakeWrite
* MakeAppend
* creates an adapter to create MD5 checksum for a file
*
* "f" [ OUT ] - return parameter for file with md5 check
*
* "out" [ IN ] - output file with write permission
* since this file is being wrapped by "f", ownership of
* the provided reference is transferred to "f"
*
* "md5" [ IN ] - md5 checksum output formatter.
* since this may be used for multiple checksums, "f" will
* attach its own reference to "md5".
*
* "path" [ IN ] - md5 checksum output file path, used to
* create standard md5sum file entry.
*
* NB - creates a write-only file that does NOT suppport random access
* i.e. must be written serially from offset 0
*/
KFS_EXTERN rc_t CC KMD5FileMakeWrite ( KMD5File **f,
struct KFile *out, KMD5SumFmt *md5, const char *path );
KFS_EXTERN rc_t CC KMD5FileMakeAppend ( KMD5File **f,
struct KFile *out, KMD5SumFmt *md5, const char *path );
/* MakeReadNew
* creates an adapter to create MD5 checksum for a file
*
* "f" [ OUT ] - return parameter for file with md5 check
*
* "in" [ IN ] - input file
* since this file is being wrapped by "f", ownership of
* the provided reference is transferred to "f"
*
* "md5" [ IN ] - md5 checksum output formatter.
* since this may be used for multiple checksums, "f" will
* attach its own reference to "md5".
*
* "path" [ IN ] - md5 checksum output file path, used to
* create standard md5sum file entry.
*
* NB - creates a write-only file that does NOT suppport random access
* i.e. must be written serially from offset 0
*/
KFS_EXTERN rc_t CC KFileMakeNewMD5Read ( const struct KFile **fp,
const struct KFile *in, KMD5SumFmt *md5, const char *path );
/* ToKFile
* an MD5 file is a subclass of KFile
* this is an explicit cast operator
*/
KFS_EXTERN struct KFile* CC KMD5FileToKFile ( KMD5File *self );
KFS_EXTERN struct KFile const* CC KMD5FileToKFileConst ( const KMD5File *self );
/* BeginTransaction
* preserve current MD5 state and file marker
* in preparation for rollback
*/
KFS_EXTERN rc_t CC KMD5FileBeginTransaction ( KMD5File *self );
/* Commit
* accept current MD5 state as correct
*/
KFS_EXTERN rc_t CC KMD5FileCommit ( KMD5File *self );
/* Revert
* reset state to previous transaction boundary conditions
*/
KFS_EXTERN rc_t CC KMD5FileRevert ( KMD5File *self );
/* Reset
* reset state to that of an empty file
* aborts any open transaction
*/
KFS_EXTERN rc_t CC KMD5FileReset ( KMD5File *self );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_md5_ */
sra_sdk-2.1.7/interfaces/kfs/mmap.h 0000644 0012213 0011620 00000007437 11476747550 016677 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_mmap_
#define _h_kfs_mmap_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KFile;
/*--------------------------------------------------------------------------
* KMMap
* a memory mapped region
*/
typedef struct KMMap KMMap;
/* AddRef
* Release
* ignores NULL references
*/
KFS_EXTERN rc_t CC KMMapAddRef ( const KMMap *self );
KFS_EXTERN rc_t CC KMMapRelease ( const KMMap *self );
/* Size
* returns size of memory region
*
* "size" [ OUT ] - return parameter for region size
*/
KFS_EXTERN rc_t CC KMMapSize ( const KMMap *self, size_t *size );
/* Position
* returns region starting offset into mapped file
*
* "pos" [ OUT ] - return parameter for file offset
*/
KFS_EXTERN rc_t CC KMMapPosition ( const KMMap *self, uint64_t *pos );
/* Reposition
* shift region to a new position
* may change region size
*
* "pos" [ IN ] - new starting position for region
*
* "size" [ OUT, NULL OKAY ] - optional return parameter
* for resultant region size
*/
KFS_EXTERN rc_t CC KMMapReposition ( const KMMap *self, uint64_t pos, size_t *size );
/* Addr
* returns starting address of memory region
*
* "addr" [ OUT ] - return parameter for memory address
*/
KFS_EXTERN rc_t CC KMMapAddrRead ( const KMMap *self, const void **addr );
KFS_EXTERN rc_t CC KMMapAddrUpdate ( KMMap *self, void **addr );
/* Make
* maps entire file
*
* "f" [ IN ] - file to map.
* a new reference will be added
*/
KFS_EXTERN rc_t CC KMMapMakeRead ( const KMMap **mm, struct KFile const *f );
KFS_EXTERN rc_t CC KMMapMakeUpdate ( KMMap **mm, struct KFile *f );
/* MakeMax
* maps as much of a file as possible
*
* "f" [ IN ] - file to map.
* a new reference will be added
*/
KFS_EXTERN rc_t CC KMMapMakeMaxRead ( const KMMap **mm, struct KFile const *f );
KFS_EXTERN rc_t CC KMMapMakeMaxUpdate ( KMMap **mm, struct KFile *f );
/* MakeRgn
* maps a portion of a file
*
* "f" [ IN ] - file to map
* a new reference will be added
*
* "pos" [ IN ] - starting offset into file
*
* "size" [ IN, DEFAULT ZERO ] - size of resulting region. if 0,
* the size will be interpreted as meaning size of "f" - "pos".
*/
KFS_EXTERN rc_t CC KMMapMakeRgnRead ( const KMMap **mm,
struct KFile const *f, uint64_t pos, size_t size );
KFS_EXTERN rc_t CC KMMapMakeRgnUpdate ( KMMap **mm,
struct KFile *f, uint64_t pos, size_t size );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_mmap_ */
sra_sdk-2.1.7/interfaces/kfs/nullfile.h 0000644 0012213 0011620 00000003731 11476747550 017550 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_nullfile_
#define _h_kfs_nullfile_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct KFile;
typedef struct KNullFile KNullFile;
/* -----
* Copy can be a serialized type KFile for a KNullFile opened for Read but
* not when opened for write.
*
* Specifically this means copy can be a KMD5File for read but not for write
* other KFile nulltypes might have the same restriction.
*
* A seekless update KNullfile can be created but does not now exist.
*/
KFS_EXTERN rc_t CC KFileMakeNullRead (const struct KFile ** self);
KFS_EXTERN rc_t CC KFileMakeNullUpdate (struct KFile ** self);
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_nullfile_ */
sra_sdk-2.1.7/interfaces/kfs/sra.h 0000644 0012213 0011620 00000014352 11645077605 016517 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_sra_
#define _h_kfs_sra_
#ifndef _h_kfs_extern_
#include
#endif
#include
#include
#include
#ifdef __cplusplus
extern "C" {
#endif
/*
* This file provides documentation and symbols for the single file archive
* format originally created for the SRA project.
*/
/*
* filler bytes before data files can be inserted to make the start line
* up on specified boundaries. By using a single bit approach for the values
* we get the bit-wise not of the mask that must be met for the start of the file.
* Or one more than the maximum number of inserted bytes. This is only used on
* creation of the file and has no bearing at all on the parsing afterwards.
* In it's only use so far any bit in a 32 bit bit number could be used not
* just these enumerated values.
*/
typedef uint32_t KSRAFileAlignment;
enum KSRAFileAlignment
{
/* align on byte count unit boundaries
* set this to the number of bytes in the alignment unit
*/
sraAlignInvalid = 0,
sraAlign1Byte = 1,
sraAlign2Byte = 2,
sraAlign4Byte = 4,
sraAlign8Byte = 8,
sraAlign16Byte = 16,
sraAlign32Byte = 32,
sraAlign64Byte = 64
};
/* ======================================================================
*
* SRA File Format
*/
typedef uint32_t SraEndian_t;
/* enum fails to handle these due to integer overflow */
#define eSraByteOrderTag 0x05031988
#define eSraByteOrderReverse 0x88190305
typedef struct KSraHeader KSraHeader;
struct KSraHeader
{
/* the first two fields are byte endian agnostic - they are low to high as shown */
uint8_t ncbi[4]; /* 'N', 'C', 'B', 'I' */
uint8_t sra[4]; /* '.', 'S', 'R', 'A' */
/* this field lets you determine the byte order of the file */
SraEndian_t byte_order;
/* not a ver_t - this is a 4 byte integer with no subfields */
uint32_t version;
union
{
struct
{
/* the only header field in the first version is the data offset */
uint64_t file_offset;
} v1;
} u;
};
/* ======================================================================
* Header format structures
*
*/
KFS_EXTERN rc_t CC SraHeaderMake (KSraHeader ** self, size_t treesize, KSRAFileAlignment alignment);
KFS_EXTERN rc_t CC SraHeaderValidate (const KSraHeader * self, bool * reverse, uint32_t * version);
KFS_EXTERN size_t CC SraHeaderSize (const KSraHeader * self);
#define FS_SRA_CUR_VERSION 1
KFS_EXTERN uint64_t CC SraHeaderGetFileOffset (const KSraHeader * self);
/*--------------------------------------------------------------------------
* forwards
*/
struct KFile;
struct KDirectory;
struct KToc;
/*--------------------------------------------------------------------------
* KDirectory
* SRA-specific extensions
*/
/* KArcParseSRA
* A parse function for sra files suitable for KDirectoryOpenArcDirRead
*
* [INOUT] KArcTOC* self The TOC (table of contents) to fill in with the parse
* [IN] const KFile* kfile The opened (as KFile) archive to parse.
*/
KFS_EXTERN rc_t CC KArcParseSRA ( struct KToc * self,
const void * kvoid,
bool (CC*ignored) (const struct KDirectory*, const char*, void*),
void *ignored_data);
KFS_EXTERN rc_t CC KArcParseSRAUnbounded ( struct KToc * self,
const void * kvoid,
bool (CC*ignored) (const struct KDirectory*, const char*, void*),
void *ignored_data);
KFS_EXTERN rc_t CC KArcParseKDir( struct KToc * self,
const void * kdir,
bool(CC*f)(const struct KDirectory*,const char *, void*),
void *filterparam);
/* KDirectoryOpenSraArchive
* opens a named SRA archive
*
* "sra_dir" [ OUT ] - return parameter for archive
*
* "chroot" [ IN ] - if non-zero, the new directory becomes
* chroot'd and will interpret paths beginning with '/'
* relative to itself.
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting sraget archive
*/
KFS_EXTERN rc_t CC KDirectoryOpenSraArchiveRead ( struct KDirectory const *self,
struct KDirectory const **sra_dir, int chroot, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVOpenSraArchiveRead ( struct KDirectory const *self,
struct KDirectory const **sra_dir, int chroot, const char *path, va_list args );
/* copycat needs an unbounded version - that is filesize is not necessarily known
* this is unsafe for most other uses */
KFS_EXTERN rc_t CC KDirectoryOpenSraArchiveReadUnbounded ( struct KDirectory const *self,
struct KDirectory const **sra_dir, int chroot, const char *path, ... );
KFS_EXTERN rc_t CC KDirectoryVOpenSraArchiveReadUnbounded ( struct KDirectory const *self,
struct KDirectory const **sra_dir, int chroot, const char *path, va_list args );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_sra_ */
sra_sdk-2.1.7/interfaces/kfs/subfile.h 0000644 0012213 0011620 00000004135 11476747550 017366 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_subfile_
#define _h_kfs_subfile_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct KFile;
typedef struct KSubFile KSubFile;
/* -----
* Copy can be a serialized type KFile for a KSubFile opened for Read but
* not when opened for write.
*
* Specifically this means copy can be a KMD5File for read but not for write
* other KFile subtypes might have the same restriction.
*
* A seekless update KSubfile can be created but does not now exist.
*/
KFS_EXTERN rc_t CC KFileMakeSubRead (const struct KFile ** self, const struct KFile * original,
uint64_t start_position, uint64_t size);
KFS_EXTERN rc_t CC KFileMakeSubUpdate (struct KFile ** self, struct KFile * original,
uint64_t start_position, uint64_t size);
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_subfile_ */
sra_sdk-2.1.7/interfaces/kfs/tar.h 0000644 0012213 0011620 00000006252 11645077605 016520 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_tar_
#define _h_kfs_tar_
#ifndef _h_kfs_extern_
#include
#endif
#include
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KFile;
struct KDirectory;
struct KToc;
/*--------------------------------------------------------------------------
* KDirectory
* TAR-specific extensions
*/
/* ParseTAR
* A parse function for tar files suitable for KDirectoryOpenArcDirRead
*
* [INOUT] KToc* self The TOC (table of contents) to fill in with the parse
* [IN] const KFile* kfile The opened (as KFile) archive to parse.
*/
KFS_EXTERN rc_t CC KArcParseTAR( struct KToc * self,
const void * kfile,
bool(CC*f)(const struct KDirectory*,const char *, void*),
void *filterparam);
/* KDirectoryOpenTarArchive
* opens a named TAR archive
*
* "tar_dir" [ OUT ] - return parameter for archive
*
* "chroot" [ IN ] - if non-zero, the new directory becomes
* chroot'd and will interpret paths beginning with '/'
* relative to itself.
*
* "path" [ IN ] - NUL terminated string in directory-native
* character set denoting target archive
*/
KFS_EXTERN int CC KDirectoryOpenTarArchiveRead ( struct KDirectory const *self,
struct KDirectory const **tar_dir, int chroot, const char *path, ... );
KFS_EXTERN int CC KDirectoryVOpenTarArchiveRead ( struct KDirectory const *self,
struct KDirectory const **tar_dir, int chroot, const char *path, va_list args );
KFS_EXTERN int CC KDirectoryOpenTarArchiveRead_silent ( struct KDirectory const *self,
struct KDirectory const **tar_dir, int chroot, const char *path, ... );
KFS_EXTERN int CC KDirectoryVOpenTarArchiveRead_silent ( struct KDirectory const *self,
struct KDirectory const **tar_dir, int chroot, const char *path, va_list args );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_tar_ */
sra_sdk-2.1.7/interfaces/kfs/teefile.h 0000644 0012213 0011620 00000004312 11476747550 017347 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_teefile_
#define _h_kfs_teefile_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct KFile;
typedef struct KTeeFile KTeeFile;
/* -----
* Copy can be a serialized type KFile for a KTeeFile opened for Read but
* not when opened for write.
*
* Specifically this means copy can be a KMD5File for read but not for write
* other KFile subtypes might have the same restriction.
*
* A seekless update KTeefile can be created but does not now exist.
*/
KFS_EXTERN rc_t CC KFileMakeTeeRead (const struct KFile ** self,
const struct KFile * original,
struct KFile * copy);
KFS_EXTERN rc_t CC KFileMakeTeeUpdate (struct KFile ** self,
struct KFile * original,
struct KFile * copy);
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_teefile_ */
sra_sdk-2.1.7/interfaces/kfs/toc.h 0000644 0012213 0011620 00000012206 11520072536 016501 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_toc_
#define _h_kfs_toc_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifndef _h_kfs_directory_
#include
#endif
#ifndef _h_klib_pbstree_
#include
#endif
#ifndef _h_kfs_sra_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*==========================================================================
* The TOC (Table of Contents) is the basis of non-O/S level file systems
* directory structures.
*
* The TOC is based on a set of entries. An entry can represent a file
* (collection of bytes), a directory (a list of entries, or a link (an
* entry that refers to another entry).
*
* Files are represented either as a contiguous array of bytes or a
* sequence of smaller chunks of contiguous bytes. Other than the initial
* creation of the chunked version, most operations on the chunked file
* will be able to treat it as a contiguous sequence with any gaps between
* contiguous chunks being treated as if they were all zero bytes. So
* for the most part the two types of file are the same to the outside
* world.
*
* A directory is viewed as a sorted list of named references to files.
* In the first versions the form is of a binary search tree per directory
* but for the most part that detail is irrelevant. In the tree a directory
* is an entry that contains its own tree. A path is a sequence of named
* entries in order - the representation of a path is the Unix/Posix style
* path.
*
* A link is either a hard or soft link 9using Unix/Posix terminology. A
* soft link is a named item that contains a path that names another item.
* A hard link will as much as possible refer directly to the same file,
* directory or another link as another item.
*
* Each entry is represented by a TocEntry.
*
* A path as mentioned above is a list of facets (names of directories) up to
* a final leaf item that can be any of the item types.
*
* Position is the logical offset within a file or a particualr byte, The
* first byte is at position 0.
*/
/*--------------------------------------------------------------------------
* forwards
*/
struct BSTree;
struct Vector;
struct String;
struct KFile;
/*--------------------------------------------------------------------------
* KTocChunk
* Describes a chunk of valid data within a file. The concept is that a file
* can be made up of discrete chunks that might not be consecutive on the
* storage system. There might also be gaps between the chunks - gaps that
* read as all zeroes. These could be tarred up versions of sparse files
* where the only things stored on disk are small regions of non-zero data.
* Or it could be some archival format where data is broken into some form of
* packets.
*
* 64 bit values are used for file sizes up to 18,446,744,073,709,551,617 bytes
* up to exabytes. The human genome is in the gigabyte range so 32 bit values
* are too close to the limits so the larger range was used.
*
* This struct is very clear and public so chunks can be built up or used freely
* by non-file-system specific code.
*/
typedef struct KTocChunk KTocChunk;
struct KTocChunk
{
/* position of chunk within logical file */
uint64_t logical_position;
/* position of chunk within source container file */
uint64_t source_position;
/* chunk size */
uint64_t size;
};
KFS_EXTERN rc_t CC KDirectoryOpenTocFileRead( const KDirectory * self,
struct KFile const ** pfile,
KSRAFileAlignment align,
bool (CC * filter) (const KDirectory*,const char*,void*),
void * filter_param,
rc_t (CC * usort)(const KDirectory*, struct Vector*) );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_toc_ */
sra_sdk-2.1.7/interfaces/kfs/ffext.h 0000644 0012213 0011620 00000003246 11476747550 017053 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_fileformat_ext_
#define _h_kfs_fileformat_ext_
#ifndef _h_kfs_extern_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct KFileFormat;
KFS_EXTERN rc_t CC KExtFileFormatMake (struct KFileFormat ** pft,
const char* ext, size_t extlen,
const char * typeAndClass, size_t tclen);
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_fileformat_ext_ */
sra_sdk-2.1.7/interfaces/kfs/ffmagic.h 0000644 0012213 0011620 00000003204 11476747550 017325 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_fileformat_magic_
#define _h_kfs_fileformat_magic_
#ifndef _h_kfs_extern_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct KFileFormat;
KFS_EXTERN rc_t CC KMagicFileFormatMake (struct KFileFormat ** pft, const char * magic_path,
const char* magic, size_t magiclen,
const char * typeAndClass, size_t tclen);
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_fileformat_magic_ */
sra_sdk-2.1.7/interfaces/kfs/extern.h 0000644 0012213 0011620 00000002753 11476747550 017246 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_extern_
#define _h_kfs_extern_
#if ! defined EXPORT_LATCH && defined _LIBRARY
#define KFS_EXTERN LIB_EXPORT
#define EXPORT_LATCH 1
#else
#define KFS_EXTERN LIB_IMPORT
#endif
#ifndef _h_klib_extern_
#include
#endif
#endif /* _h_kfs_extern_ */
sra_sdk-2.1.7/interfaces/kfs/pagefile.h 0000644 0012213 0011620 00000011770 11542741407 017501 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_pagefile_
#define _h_kfs_pagefile_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KFile;
/*--------------------------------------------------------------------------
* KPage
* a reference counted page
*/
typedef struct KPage KPage;
/* AddRef
* Release
* ignores NULL references
*/
KFS_EXTERN rc_t CC KPageAddRef ( const KPage *self );
KFS_EXTERN rc_t CC KPageRelease ( const KPage *self );
/* Id
* returns page id
*
* "page_id" [ OUT ] - return parameter for page id
*/
KFS_EXTERN rc_t CC KPageId ( const KPage *self, uint32_t *page_id );
/* ConstSize
* returns constant page size
*/
KFS_EXTERN size_t CC KPageConstSize ( void );
/* AccessRead
* AccessUpdate
* gain access to page memory
* update access marks page as modified
*
* "mem" [ OUT ] - pointer to page
*
* "bytes" [ OUT, NULL OKAY ] - page size in bytes
*/
KFS_EXTERN rc_t CC KPageAccessRead ( const KPage *self, const void **mem, size_t *bytes );
KFS_EXTERN rc_t CC KPageAccessUpdate ( KPage *self, void **mem, size_t *bytes );
/*--------------------------------------------------------------------------
* KPageFile
* presents some level of page management on top of a random-access KFile
*/
typedef struct KPageFile KPageFile;
/* Make
* creates a page file
*
* "pf" [ OUT ] - return parameter for page file
*
* "backing" [ IN ] - backing file
* NB - attaches a new reference to file
* does not take ownership
*
* "climit" [ IN ] - cache size limit
*
* "write_through" [ IN ] - if true, causes page flushing
* on each KPageRelease message if modified.
*/
KFS_EXTERN rc_t CC KPageFileMakeRead ( const KPageFile **pf,
struct KFile const *backing, size_t climit );
KFS_EXTERN rc_t CC KPageFileMakeUpdate ( KPageFile **pf,
struct KFile *backing, size_t climit, bool write_through );
/* AddRef
* Release
* ignores NULL references
*/
KFS_EXTERN rc_t CC KPageFileAddRef ( const KPageFile *self );
KFS_EXTERN rc_t CC KPageFileRelease ( const KPageFile *self );
/* Size
* returns size in bytes of file and cache
*
* "lsize" [ OUT, NULL OKAY ] - return parameter for logical size
*
* "fsize" [ OUT, NULL OKAY ] - return parameter for file size
*
* "csize" [ OUT, NULL OKAY ] - return parameter for cache size
*/
KFS_EXTERN rc_t CC KPageFileSize ( const KPageFile *self,
uint64_t *lsize, uint64_t *fsize, size_t *csize );
/* SetSize
* extends or truncates underlying file
* may affect cache contents
*
* "size" [ IN ] - logical size
*/
KFS_EXTERN rc_t CC KPageFileSetSize ( KPageFile *self, uint64_t size );
/* Alloc
* allocates a new page
* the page will be zeroed and initially unmodified
*
* "page" [ OUT ] - return parameter for page object
*
* "page_id" [ OUT, NULL OKAY ] - optional return parameter for page id
*/
KFS_EXTERN rc_t CC KPageFileAlloc ( KPageFile *self, KPage **page, uint32_t *page_id );
/* Get
* returns an existing page
*
* "page" [ OUT ] - return parameter for page object
*
* "page_id" [ IN ] - id of page to retrieve
*/
KFS_EXTERN rc_t CC KPageFileGet ( KPageFile *self, KPage **page, uint32_t page_id );
/* PosGet
* returns a page corresponding to position
*
* "page" [ OUT ] - return parameter for page object
*
* "offset" [ IN ] - offset to a byte within file
*/
KFS_EXTERN rc_t CC KPageFilePosGet ( KPageFile *self, KPage **page, uint64_t offset );
/* DropBacking
* used immediately prior to releasing
* prevents modified pages from being flushed to disk
* renders object nearly useless
*/
KFS_EXTERN rc_t CC KPageFileDropBacking ( KPageFile *self );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_pagefile_ */
sra_sdk-2.1.7/interfaces/kfs/arrayfile.h 0000664 0012213 0011620 00000011112 11576721672 017704 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_arrayfile_
#define _h_kfs_arrayfile_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifndef _h_klib_namelist_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KFile;
/*--------------------------------------------------------------------------
* KArrayFile
* an array-file is created from a KFile
*/
typedef struct KArrayFile KArrayFile;
/* Make
* make an array file from a KFile
*/
/*
KFS_EXTERN rc_t CC KArrayFileMakeRead ( const KArrayFile **af, struct KFile const *file );
KFS_EXTERN rc_t CC KArrayFileMakeUpdate ( KArrayFile **af, struct KFile *file );
*/
/* AddRef
* Release
* ignores NULL references
*/
KFS_EXTERN rc_t CC KArrayFileAddRef ( const KArrayFile *self );
KFS_EXTERN rc_t CC KArrayFileRelease ( const KArrayFile *self );
/* Dimensionality
* returns the number of dimensions in the ArrayFile
*
* "dim" [ OUT ] - return parameter for number of dimensions
*/
KFS_EXTERN rc_t CC KArrayFileDimensionality ( const KArrayFile *self, uint8_t *dim );
/* SetDimensionality
* sets the number of dimensions in the ArrayFile
*
* "dim" [ IN ] - new number of dimensions; must be > 0
*/
KFS_EXTERN rc_t CC KArrayFileSetDimensionality ( KArrayFile *self, uint8_t dim );
/* DimExtents
* returns the extent of every dimension
*
* "dim" [ IN ] - the dimensionality of "extents"
*
* "extents" [ OUT ] - returns the extent for every dimension
*/
KFS_EXTERN rc_t CC KArrayFileDimExtents ( const KArrayFile *self, uint8_t dim, uint64_t *extents );
/* SetDimExtents
* sets the new extents for every dimension
*
* "dim" [ IN ] - the dimensionality of "extents"
*
* "extents" [ IN ] - new extents for every dimension
*/
KFS_EXTERN rc_t CC KArrayFileSetDimExtents ( KArrayFile *self, uint8_t dim, uint64_t *extents );
/* ElementSize
* returns the element size in bits
*
* "elem_bits" [ OUT ] - size of each element in bits
*/
KFS_EXTERN rc_t CC KArrayFileElementSize ( const KArrayFile *self, uint64_t *elem_bits );
/* Read
* read from n-dimensional position
*
* "dim" [ IN ] - the dimensionality of all vectors
*
* "pos" [ IN ] - n-dimensional starting position in elements
*
* "buffer" [ OUT ] and "elem_count" [ IN ] - return buffer for read
* where "elem_count" is n-dimensional in elements
*
* "num_read" [ OUT ] - n-dimensional return parameter giving back
* the number of read elements in every dimension
*/
KFS_EXTERN rc_t CC KArrayFileRead ( const KArrayFile *self, uint8_t dim,
const uint64_t *pos, void *buffer, const uint64_t *elem_count,
uint64_t *num_read );
/* Write
* write into n-dimensional position
*
* "dim" [ IN ] - the dimensionality of all vectors
*
* "pos" [ IN ] - n-dimensional offset where to write to
* in elements
*
* "buffer" [ IN ] and "elem_count" [ IN ] - data to be written
* where "elem_count" is n-dimensional in elements
*
* "num_writ" [ OUT, NULL OKAY ] - optional return parameter
* giving number of elements actually written per dimension
*/
KFS_EXTERN rc_t CC KArrayFileWrite ( KArrayFile *self, uint8_t dim,
const uint64_t *pos, const void *buffer, const uint64_t *elem_count,
uint64_t *num_writ );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_arrayfile_ */
sra_sdk-2.1.7/interfaces/kfs/pmem.h 0000664 0012213 0011620 00000010413 11550613243 016651 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_pmem_
#define _h_kfs_pmem_
#ifndef _h_kfs_extern_
#include
#endif
#ifndef _h_klib_defs_
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------
* forwards
*/
struct KPageFile;
/*--------------------------------------------------------------------------
* KMemBank
* manages simple blocks of memory
* optionally backed by a persistent page file
*/
typedef struct KMemBank KMemBank;
/* Make
* make a memory bank with a fixed block size
* the total amount of memory may be limited
* the memory may be drawn from an externally supplied page file
*
* "block_size" [ IN ] - must be an even multiple of 2, minimum 64
*
* "limit" [ IN, DFLT ZERO ] - the maximum number of bytes
* to be allocated zero for unlimited
*
* "backing" [ IN, NULL OKAY ] - a page source for allocator.
* a new reference will be added if not null.
*/
KFS_EXTERN rc_t CC KMemBankMake ( KMemBank **bank,
size_t block_size, uint64_t limit, struct KPageFile *backing );
/* AddRef
* Release
*/
KFS_EXTERN rc_t CC KMemBankAddRef ( const KMemBank *self );
KFS_EXTERN rc_t CC KMemBankRelease ( const KMemBank *self );
/* Alloc
* allocate memory
*
* "id" [ OUT ] - return parameter for memory allocation id
*
* "bytes" [ IN ] - the number of bytes to allocate
*
* "clear" [ IN ] - if true, initialize the memory to zero
*/
KFS_EXTERN rc_t CC KMemBankAlloc ( KMemBank *self,
uint64_t *id, uint64_t bytes, bool clear );
/* Free
* free memory
*
* "id" [ IN, ZERO OKAY ] - id of the allocation to be freed
*/
KFS_EXTERN rc_t CC KMemBankFree ( KMemBank *self, uint64_t id );
/* Size
* returns the allocated capacity of the memory object
*
* "id" [ IN ] - id of the allocation
*
* "size" [ OUT ] - return parameter
*/
KFS_EXTERN rc_t CC KMemBankSize ( const KMemBank *self, uint64_t id, uint64_t *size );
/* SetSize
* performs a reallocation of memory object
*
* "id" [ IN ] - id of the allocation being resized
*
* "size" [ IN ] - new capacity
*/
KFS_EXTERN rc_t CC KMemBankSetSize ( KMemBank *self, uint64_t id, uint64_t size );
/* Read
* linearly access memory
*
* "id" [ IN ] - id of the allocation being read
*
* "pos" [ IN ] - starting offset into allocation
*
* "buffer" [ IN ] and "bsize" [ IN ] - buffer for returned data
*
* "num_read" [ OUT ] - return parameter for the number of bytes read
*/
KFS_EXTERN rc_t CC KMemBankRead ( const KMemBank *self, uint64_t id,
uint64_t pos, void *buffer, size_t bsize, size_t *num_read );
/* Write
* linearly update memory
* will resize as required
*
* "id" [ IN ] - id of the allocation being writ
*
* "pos" [ IN ] - starting offset into allocation
*
* "buffer" [ IN ] and "size" [ IN ] - data to write
*
* "num_writ" [ OUT ] - return parameter for the number of bytes written
*/
KFS_EXTERN rc_t CC KMemBankWrite ( KMemBank *self, uint64_t id,
uint64_t pos, const void *buffer, size_t size, size_t *num_writ );
#ifdef __cplusplus
}
#endif
#endif /* _h_kfs_pmem_ */
sra_sdk-2.1.7/interfaces/kfs/kfs-priv.h 0000664 0012213 0011620 00000006503 11645077605 017474 0 ustar rodarmer trace /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _h_kfs_priv_
#define _h_kfs_priv_
#ifndef _h_kfs_extern_
#include