Commit ae9ddeac authored by Filippo Rusconi's avatar Filippo Rusconi

New upstream version 78

parent 49fb7b4d
......@@ -39,6 +39,8 @@ int main(int argc, char *argv[]){
else
printf("failure: scan %d\n", s.getScanNumber());
printf("size: %d\n", s.sizeMZ());
s.getNativeID(nativeID, 256);
printf("%s\n",nativeID);
printf("S\t%d\t%d",s.getScanNumber(),s.getScanNumber());
......@@ -54,7 +56,7 @@ int main(int argc, char *argv[]){
//printf("I\tConvE\t%.6lf\n",s.getConversionE());
//printf("I\tConvI\t%.6lf\n",s.getConversionI());
for(j=0;j<s.sizeZ();j++){
printf("Z\t%d\t%.*f\n",s.atZ(j).z,6,s.atZ(j).mz);
printf("Z\t%d\t%.*f\n",s.atZ(j).z,6,s.atZ(j).mh);
}
for(j=0;j<s.size();j++){
......
......@@ -114,7 +114,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="&quot;C:\Users\mhoopman\Documents\Software Development\MSToolkit-Google\include&quot;"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
......@@ -135,7 +135,7 @@
Name="VCLinkerTool"
AdditionalDependencies="MSToolkitLite.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;C:\Users\mhoopman\Documents\Software Development\MSToolkit-Google\Release&quot;"
AdditionalLibraryDirectories="&quot;C:\Users\mhoopman\Documents\Software Development\MSToolkit\Release&quot;"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
......

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSToolkit", "MSToolkit.vcproj", "{D2646DE9-A31A-4C6E-99C6-B81885C17A93}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSToolkitCLR", "MSToolkitCLR.vcproj", "{48702313-7D61-4679-BF85-FBF1A1C34C52}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSToolkitLite", "MSToolkitLite.vcproj", "{8093FAFA-4AA1-4E88-A83E-1B433A96AAE5}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSToolkitLiteCLR", "MSToolkitLiteCLR.vcproj", "{0B0E7480-5938-4388-B57D-66A262E601C8}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSSingleScan", "MSSingleScan\MSSingleScan.vcproj", "{24C852FB-C978-4957-BC4D-92F27FD031AE}"
ProjectSection(ProjectDependencies) = postProject
{8093FAFA-4AA1-4E88-A83E-1B433A96AAE5} = {8093FAFA-4AA1-4E88-A83E-1B433A96AAE5}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D2646DE9-A31A-4C6E-99C6-B81885C17A93}.Debug|Win32.ActiveCfg = Debug|Win32
{D2646DE9-A31A-4C6E-99C6-B81885C17A93}.Debug|Win32.Build.0 = Debug|Win32
{D2646DE9-A31A-4C6E-99C6-B81885C17A93}.Release|Win32.ActiveCfg = Release|Win32
{D2646DE9-A31A-4C6E-99C6-B81885C17A93}.Release|Win32.Build.0 = Release|Win32
{48702313-7D61-4679-BF85-FBF1A1C34C52}.Debug|Win32.ActiveCfg = Debug|Win32
{48702313-7D61-4679-BF85-FBF1A1C34C52}.Debug|Win32.Build.0 = Debug|Win32
{48702313-7D61-4679-BF85-FBF1A1C34C52}.Release|Win32.ActiveCfg = Release|Win32
{48702313-7D61-4679-BF85-FBF1A1C34C52}.Release|Win32.Build.0 = Release|Win32
{8093FAFA-4AA1-4E88-A83E-1B433A96AAE5}.Debug|Win32.ActiveCfg = Debug|Win32
{8093FAFA-4AA1-4E88-A83E-1B433A96AAE5}.Debug|Win32.Build.0 = Debug|Win32
{8093FAFA-4AA1-4E88-A83E-1B433A96AAE5}.Release|Win32.ActiveCfg = Release|Win32
{8093FAFA-4AA1-4E88-A83E-1B433A96AAE5}.Release|Win32.Build.0 = Release|Win32
{0B0E7480-5938-4388-B57D-66A262E601C8}.Debug|Win32.ActiveCfg = Debug|Win32
{0B0E7480-5938-4388-B57D-66A262E601C8}.Debug|Win32.Build.0 = Debug|Win32
{0B0E7480-5938-4388-B57D-66A262E601C8}.Release|Win32.ActiveCfg = Release|Win32
{0B0E7480-5938-4388-B57D-66A262E601C8}.Release|Win32.Build.0 = Release|Win32
{24C852FB-C978-4957-BC4D-92F27FD031AE}.Debug|Win32.ActiveCfg = Debug|Win32
{24C852FB-C978-4957-BC4D-92F27FD031AE}.Debug|Win32.Build.0 = Debug|Win32
{24C852FB-C978-4957-BC4D-92F27FD031AE}.Release|Win32.ActiveCfg = Release|Win32
{24C852FB-C978-4957-BC4D-92F27FD031AE}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
#Set your paths here.
ZLIB_PATH = ./src/zLib-1.2.5
ZLIB_PATH = ./src/zlib-1.2.8
MZPARSER_PATH = ./src/mzParser
EXPAT_PATH = ./src/expat-2.0.1
EXPAT_PATH = ./src/expat-2.2.0
SQLITE_PATH = ./src/sqlite-3.7.7.1
MST_PATH = ./src/MSToolkit
......@@ -13,7 +13,7 @@ MZPARSERLITE = mzp.MSNumpress.o mzp.mzp_base64_lite.o mzp.BasicSpectrum_lite.o m
mzp.saxmzxmlhandler_lite.o mzp.Czran_lite.o mzp.mz5handler_lite.o mzp.mzpMz5Config_lite.o mzp.mzpMz5Structs_lite.o mzp.BasicChromatogram_lite.o mzp.PWIZface_lite.o
EXPAT = xmlparse.o xmlrole.o xmltok.o
ZLIB = adler32.o compress.o crc32.o deflate.o inffast.o inflate.o infback.o inftrees.o trees.o uncompr.o zutil.o
MSTOOLKIT = Spectrum.o MSObject.o
MSTOOLKIT = Spectrum.o MSObject.o mzMLWriter.o pepXMLWriter.o
READER = MSReader.o
READERLITE = MSReaderLite.o
SQLITE = sqlite3.o
......@@ -116,5 +116,13 @@ MSReaderLite.o : $(MST_PATH)/MSReader.cpp
MSObject.o : $(MST_PATH)/MSObject.cpp
$(CC) $(CFLAGS) $(MST_PATH)/MSObject.cpp -c
mzMLWriter.o : $(MST_PATH)/mzMLWriter.cpp
$(CC) $(CFLAGS) $(MST_PATH)/mzMLWriter.cpp -c
pepXMLWriter.o : $(MST_PATH)/pepXMLWriter.cpp
$(CC) $(CFLAGS) $(MST_PATH)/pepXMLWriter.cpp -c
# MSToolkit
The MSToolkit is a light-weight C++ library for reading, writing, and manipulating mass spectrometry data. The MSToolkit is easily linked to virtually any C++ algorithm for simple, fast file reading and analysis.
### Supported File Formats
* *mzML* including internal compression (zlib and numpress) and external compression (.mzML.gz) _read/write\*_
* *mzXML* including internal compression (zlib) and external compression (.mzXML.gz) _read-only_
* *mgf* _read/write_
* *ms1* _read/write_
* *ms2* _read/write_
* *bms1* _read/write_
* *bms2* _read/write_
* *cms1* _read/write_
* *cms2* _read/write_
* *RAW* Thermo proprietary file format (Windows only, requires Xcalibur/MSFileReader) _read-only_
_\* Note: .mzML writing produces funtional files, but currently does not export all meta data. Spectral peak data is complete. .mzML.gz files
are not produced by the toolkit, and must be gzipped externally._
### Simple Interface
* Open any file format from a single function call.
* Store any spectrum in a simple, comprehensive data structure.
* Sequential or random-access file reading.
### Easy Integration
* All headers included from a single location.
* Single library file easily linked by the compiler.
### Compiling
A few hints:
* Add _NOSQLITE to build smaller library without SQLite. SQLite is only required for special case usage.
* Add _NO_THERMORAW to build without Thermo file support in Windows. This is not necessary in Linux, where Thermo support is disabled by default.
* Older versions of MSVC may require building with XML_STATIC declared.
* Declaring WIN32 may still be required for compiling 64-bit libraries with MSVC.
### License
Code written for the MSToolkit uses the Apache License, Version 2.0. All 3rd party software included in the MSToolkit library retains its original license.
This diff is collapsed.
/*
Copyright 2005-2016, Michael R. Hoopmann
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef _MSOBJECT_H
#define _MSOBJECT_H
......
/*
Copyright 2005-2016, Michael R. Hoopmann
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef _MSREADER_H
#define _MSREADER_H
#include "Spectrum.h"
#include "MSObject.h"
#include "mzParser.h"
#include <cstring>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
......@@ -14,27 +29,22 @@
//#include "MSToolkitInterface.h"
#ifdef _MSC_VER
//#include <atlstr.h>
//#import "XRawfile2.dll" rename_namespace("XRawfile")
//using namespace XRAWFILE2Lib;
//Explicit path is needed on systems where Xcalibur installs with errors
//For example, Vista-64bit
//#import "C:\Xcalibur\system\programs\XRawfile2.dll"
#import "MSFileReader.XRawfile2.dll" rename_namespace("XRawfile")
#ifndef _NO_THERMORAW
#import "libid:F0C5F3E3-4F2A-443E-A74D-0AABE3237494" rename_namespace("XRawfile")
//#import "libid:5FE970A2-29C3-11D3-811D-00104B304896" rename_namespace("XRawfile")
using namespace XRawfile;
#endif
#endif
#ifndef _NOSQLITE
#include <sqlite3.h>
#endif
//Macros for 64-bit file support
#ifdef _MSC_VER
#ifndef _NO_THERMORAW
#include "RAWReader.h"
//extern "C" int __cdecl _fseeki64(FILE *, __int64, int);
//extern "C" __int64 __cdecl _ftelli64(FILE *);
#endif
typedef __int64 f_off;
#define fseek(h,p,o) _fseeki64(h,p,o)
#define ftell(h) _ftelli64(h)
......@@ -69,6 +79,7 @@ class MSReader {
MSFileFormat checkFileFormat(const char *fn);
string getCurrentFile();
MSSpectrumType getFileType();
MSHeader& getHeader();
void getInstrument(char* str);
......@@ -84,6 +95,7 @@ class MSReader {
void writeFile(const char* c, bool text, MSObject& m);
void writeFile(const char* c, MSFileFormat ff, MSObject& m, char* sha1Report='\0');
bool readMGFFile(const char* c, Spectrum& s); //Note, no random-access of MGF files.
bool readMSTFile(const char* c, bool text, Spectrum& s, int scNum=0);
bool readMZPFile(const char* c, Spectrum& s, int scNum=0);
bool readFile(const char* c, Spectrum& s, int scNum=0);
......@@ -100,6 +112,7 @@ class MSReader {
//For MGF files
void setHighResMGF(bool b);
void setOnePlusMGF(bool b);
//File compression
void setCompression(bool b);
......@@ -122,7 +135,9 @@ class MSReader {
int iMZPrecision;
int iVersion;
int iFType;
int lastReadScanNum;
MSFileFormat lastFileFormat;
string sCurrentFile;
string sInstrument;
string sManufacturer;
......@@ -140,9 +155,13 @@ class MSReader {
//for RAW file support (even if not on windows)
bool rawFileOpen;
//for mgf output
//for mgf support
char strMGF[1024];
bool exportMGF;
bool highResMGF;
bool mgfOnePlus;
int mgfIndex;
vector<int> mgfGlobalCharge;
//Functions
void closeFile();
......@@ -158,8 +177,10 @@ class MSReader {
//support for rawfiles
#ifdef _MSC_VER
#ifndef _NO_THERMORAW
RAWReader cRAW;
#endif
#endif
//support for sqlite
#ifndef _NOSQLITE
......
/*
Copyright 2005-2016, Michael R. Hoopmann
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef _MSTOOLKITTYPES_H
#define _MSTOOLKITTYPES_H
......@@ -53,6 +68,7 @@ enum MSActivation {
mstCID,
mstECD,
mstETD,
mstETDSA,
mstPQD,
mstHCD,
mstIRMPD,
......@@ -107,7 +123,7 @@ struct Peak_T {
struct ZState {
int z;
double mz; //M+H, not mz
double mh; //M+H, not mz
};
struct EZState {
......
/*
Copyright 2005-2016, Michael R. Hoopmann
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef _RAWREADER_H
#define _RAWREADER_H
#ifdef _MSC_VER
#ifndef _NO_THERMORAW
#include "MSToolkitTypes.h"
#include "Spectrum.h"
#include <algorithm>
#include <iostream>
#include <vector>
//#include <cstring>
//#include <cstdlib>
//#include <iomanip>
//Explicit path is needed on systems where Xcalibur installs with errors
//For example, Vista-64bit
//#import "C:\Xcalibur\system\programs\XRawfile2.dll"
#import "MSFileReader.XRawfile2.dll" rename_namespace("XRawfile")
#include <objbase.h>
#import "libid:F0C5F3E3-4F2A-443E-A74D-0AABE3237494" rename_namespace("XRawfile")
//#import "libid:5FE970A2-29C3-11D3-811D-00104B304896" rename_namespace("XRawfile")
using namespace XRawfile;
using namespace std;
namespace MSToolkit {
typedef struct rawPrecursorInfo{
double dIsoMZ;
double dMonoMZ;
long charge;
long parScanNum;
rawPrecursorInfo(){
dIsoMZ=0;
dMonoMZ=0;
charge=0;
parScanNum=0;
}
void clear(){
dIsoMZ = 0;
dMonoMZ = 0;
charge = 0;
parScanNum = 0;
}
} rawPrecursorInfo;
class RAWReader {
public:
//Constructors & Destructors
......@@ -51,6 +84,7 @@ private:
bool rawLabel;
bool rawUserFilterExact;
char rawCurrentFile[256];
char rawInstrument[256];
char rawManufacturer[256];
char rawUserFilter[256];
......@@ -62,12 +96,15 @@ private:
long rawTotSpec;
IXRawfilePtr m_Raw;
vector<MSSpectrumType>* msLevelFilter;
//Private Functions
int calcChargeState(double precursormz, double highmass, VARIANT* varMassList, long nArraySize);
double calcPepMass(int chargestate, double precursormz);
MSSpectrumType evaluateFilter(long scan, char* chFilter, vector<double>& MZs, bool& bCentroid, double& cv, MSActivation& act);
double evaluateTrailerDouble(const char* id);
int evaluateTrailerInt(const char* id);
bool initRaw();
......@@ -75,4 +112,6 @@ private:
}
#endif
#endif
\ No newline at end of file
#endif
#endif
/*
Copyright 2005-2016, Michael R. Hoopmann
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef _SPECTRUM_H
#define _SPECTRUM_H
......@@ -68,6 +83,10 @@ class Spectrum {
float getRTime();
float getRTimeApex();
int getScanNumber(bool second=false);
double getScanWindowLower();
double getScanWindowUpper();
double getSelWindowLower();
double getSelWindowUpper();
double getTIC();
int getMsLevel();
void setActivationMethod(MSActivation);
......@@ -91,6 +110,8 @@ class Spectrum {
void setRTime(float);
void setRTimeApex(float);
void setScanNumber(int, bool second=false);
void setScanWindow(double lower, double upper); //the mass range of the spectrum
void setSelWindow(double lower, double upper); //the mass range of the selected/acquired ions
void setTIC(double);
void setMsLevel(int level);
int size();
......@@ -119,15 +140,15 @@ class Spectrum {
//Data Members
vector<Peak_T> *vPeaks;
vector<EZState> *vEZ;
vector<ZState> *vZ;
vector<EZState> *vEZ; //extended z-lines with charge state, M+H, and peak information.
vector<ZState> *vZ; //presumed charge states and M+H; M can be monoisotopic or selected.
int charge;
float rTime;
int scanNumber;
int scanNumber2;
int msLevel;
vector<double> *monoMZ;
vector<double> *mz;
vector<double> *monoMZ; //the monoisotopic m/z of the selected ion(s)
vector<double> *mz; //the selected ion(s) in m/z
MSSpectrumType fileType;
MSActivation actMethod;
int scanID; //index for sqlite
......@@ -140,13 +161,17 @@ class Spectrum {
double convD;
double convE;
double convI;
double selectionWinLower;
double selectionWinUpper;
double TIC;
double BPM; //Base Peak Mass
float rTimeApex; //retention time of precursor apex (MS2)
float area; //summed peak areas of precursor (MS2)
char nativeID[256]; //spectrumNativeID in mzML files
char rawFilter[256]; //RAW file header line
int centroidStatus; //0=profile, 1=centroid, 2=unknown
double BPM; //Base Peak Mass
float rTimeApex; //retention time of precursor apex (MS2)
float area; //summed peak areas of precursor (MS2)
char nativeID[256]; //spectrumNativeID in mzML files
char rawFilter[256]; //RAW file header line
int centroidStatus; //0=profile, 1=centroid, 2=unknown
double scanWinLower; //the instrument spectrum m/z range
double scanWinUpper; //the instrument spectrum m/z range
//private:
//Functions
......
#ifndef AMIGACONFIG_H
#define AMIGACONFIG_H
/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
#define BYTEORDER 4321
/* Define to 1 if you have the `bcopy' function. */
#define HAVE_BCOPY 1
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* whether byteorder is bigendian */
#define WORDS_BIGENDIAN
/* Define to specify how much context to retain around the current parse
point. */
#define XML_CONTEXT_BYTES 1024
/* Define to make parameter entity parsing functionality available. */
#define XML_DTD
/* Define to make XML Namespaces functionality available. */
#define XML_NS
#endif /* AMIGACONFIG_H */
......@@ -2,7 +2,7 @@
* Generated automatically by crc32.c
*/
local const unsigned long FAR crc_table[TBLS][256] =
local const z_crc_t FAR crc_table[TBLS][256] =
{
{
0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
......
/* deflate.h -- internal compression state
* Copyright (C) 1995-2010 Jean-loup Gailly
* Copyright (C) 1995-2012 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
*/
......@@ -48,6 +48,9 @@
#define MAX_BITS 15
/* All codes must not exceed MAX_BITS bits */
#define Buf_size 16
/* size of bit buffer in bi_buf */
#define INIT_STATE 42
#define EXTRA_STATE 69
#define NAME_STATE 73
......@@ -101,7 +104,7 @@ typedef struct internal_state {
int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
gz_headerp gzhead; /* gzip header information to write */
uInt gzindex; /* where in extra, name, or comment */
Byte method; /* STORED (for zip only) or DEFLATED */
Byte method; /* can only be DEFLATED */
int last_flush; /* value of flush param for previous deflate call */
/* used by deflate.c: */
......@@ -188,7 +191,7 @@ typedef struct internal_state {
int nice_match; /* Stop searching when current match exceeds this */
/* used by trees.c: */
/* Didn't use ct_data typedef below to supress compiler warning */
/* Didn't use ct_data typedef below to suppress compiler warning */
struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
......@@ -244,7 +247,7 @@ typedef struct internal_state {
ulg opt_len; /* bit length of current block with optimal trees */
ulg static_len; /* bit length of current block with static trees */
uInt matches; /* number of string matches in current block */
int last_eob_len; /* bit length of EOB code for last block */
uInt insert; /* bytes at end of window left to insert */
#ifdef DEBUG
ulg compressed_len; /* total bit length of compressed file mod 2^32 */
......@@ -294,6 +297,7 @@ void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
ulg stored_len, int last));
void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
ulg stored_len, int last));
......
......@@ -342,7 +342,7 @@ XML_SetEntityDeclHandler(XML_Parser parser,
XML_EntityDeclHandler handler);
/* OBSOLETE -- OBSOLETE -- OBSOLETE
This handler has been superceded by the EntityDeclHandler above.
This handler has been superseded by the EntityDeclHandler above.
It is provided here for backward compatibility.
This is called for a declaration of an unparsed (NDATA) entity.
......@@ -742,6 +742,29 @@ XML_GetSpecifiedAttributeCount(XML_Parser parser);
XMLPARSEAPI(int)
XML_GetIdAttributeIndex(XML_Parser parser);
#ifdef XML_ATTR_INFO
/* Source file byte offsets for the start and end of attribute names and values.
The value indices are exclusive of surrounding quotes; thus in a UTF-8 source
file an attribute value of "blah" will yield:
info->valueEnd - info->valueStart = 4 bytes.
*/
typedef struct {
XML_Index nameStart; /* Offset to beginning of the attribute name. */
XML_Index nameEnd; /* Offset after the attribute name's last byte. */
XML_Index valueStart; /* Offset to beginning of the attribute value. */
XML_Index valueEnd; /* Offset after the attribute value's last byte. */
} XML_AttrInfo;
/* Returns an array of XML_AttrInfo structures for the attribute/value pairs
passed in last call to the XML_StartElementHandler that were specified
in the start-tag rather than defaulted. Each attribute/value pair counts
as 1; thus the number of entries in the array is
XML_GetSpecifiedAttributeCount(parser) / 2.
*/
XMLPARSEAPI(const XML_AttrInfo *)
XML_GetAttributeInfo(XML_Parser parser);
#endif
/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is
detected. The last call to XML_Parse must have isFinal true; len
may be zero for this call (or any other).
......@@ -883,6 +906,15 @@ XMLPARSEAPI(int)
XML_SetParamEntityParsing(XML_Parser parser,
enum XML_ParamEntityParsing parsing);
/* Sets the hash salt to use for internal hash calculations.
Helps in preventing DoS attacks based on predicting hash
function behavior. This must be called before parsing is started.
Returns 1 if successful, 0 when called after parsing has started.
*/
XMLPARSEAPI(int)
XML_SetHashSalt(XML_Parser parser,
unsigned long hash_salt);
/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
XML_GetErrorCode returns information about the error.
*/
......@@ -941,9 +973,12 @@ XML_FreeContentModel(XML_Parser parser, XML_Content *model);
/* Exposing the memory handling functions used in Expat */
XMLPARSEAPI(void *)
XML_ATTR_MALLOC
XML_ATTR_ALLOC_SIZE(2)
XML_MemMalloc(XML_Parser parser, size_t size);
XMLPARSEAPI(void *)
XML_ATTR_ALLOC_SIZE(3)
XML_MemRealloc(XML_Parser parser, void *ptr, size_t size);
XMLPARSEAPI(void)
......@@ -984,7 +1019,8 @@ enum XML_FeatureEnum {
XML_FEATURE_SIZEOF_XML_CHAR,
XML_FEATURE_SIZEOF_XML_LCHAR,
XML_FEATURE_NS,
XML_FEATURE_LARGE_SIZE
XML_FEATURE_LARGE_SIZE,
XML_FEATURE_ATTR_INFO
/* Additional features must be added to the end of this enum. */
};
......@@ -998,14 +1034,12 @@ XMLPARSEAPI(const XML_Feature *)
XML_GetFeatureList(void);
/* Expat follows the GNU/Linux convention of odd number minor version for
beta/development releases and even number minor version for stable
releases. Micro is bumped with each release, and set to 0 with each
change to major or minor version.
/* Expat follows the semantic versioning convention.
See http://semver.org.
*/
#define XML_MAJOR_VERSION 2
#define XML_MINOR_VERSION 0
#define XML_MICRO_VERSION 1
#define XML_MINOR_VERSION 2
#define XML_MICRO_VERSION 0
#ifdef __cplusplus
}
......
......@@ -65,12 +65,26 @@
#endif
#endif /* not defined XML_STATIC */
#if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4)
#define XMLIMPORT __attribute__ ((visibility ("default")))
#endif
/* If we didn't define it above, define it away: */
#ifndef XMLIMPORT
#define XMLIMPORT
#endif
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
#define XML_ATTR_MALLOC __attribute__((__malloc__))
#else
#define XML_ATTR_MALLOC
#endif
#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
#define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
#else
#define XML_ATTR_ALLOC_SIZE(x)
#endif
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
......
/* gzguts.h -- zlib internal header definitions for gz* operations
* Copyright (C) 2004, 2005, 2010 Mark Adler
* Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
......@@ -12,7 +12,7 @@
# endif
#endif
#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
#ifdef HAVE_HIDDEN
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
#else
# define ZLIB_INTERNAL
......@@ -27,13 +27,80 @@
#endif
#include <fcntl.h>
#ifdef _WIN32
# include <stddef.h>
#endif
#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
# include <io.h>
#endif