Browse code

o BUG FIX: readCdfGroupNames() would crash on Unix due to a bug introduced when fixing the missing null-terminator bug last week. o Windows build change: The Windows version is building against the Windows code of Fusion SDK not the POSIX code. In order to do this we have had to patch the preprocessor code in several of the Fusion SDK source-code files, which has to be redone manually whenever Fusion is updated. Starting with this version, we instead set the _MSC_VER flag used in the Fusion code to indicate Windows (set by the Microsoft Visual C++ compiler). Since we are using MINGW this flag is obviously not set. Faking _MSC_VER this way leaves us only having to patch one single file in the Fusion release instead of 10-20. Hopefully there are no other side effects.

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/affxparser@21012 bc3139a8-67e5-0310-9ffc-ced21a209358

Henrik Bengtsson authored on 07/11/2006 01:27:25
Showing 20 changed files

... ...
@@ -1,6 +1,6 @@
1 1
 Package: affxparser
2 2
 Version: 1.7.1
3
-Date: 2006-11-01
3
+Date: 2006-11-03
4 4
 Title: Affymetrix File Parsing SDK
5 5
 Author: Henrik Bengtsson, James Bullard, Kasper Daniel Hansen
6 6
 Maintainer: Kasper Daniel Hansen <khansen@stat.berkeley.edu>
... ...
@@ -1,7 +1,7 @@
1 1
 Package: affxparser
2 2
 ===================
3 3
 
4
-Version: 1.7.1 [2006-11-01]
4
+Version: 1.7.1 [2006-11-03]
5 5
 o Updated to Fusion SDK v1.0.8.
6 6
 o BUG FIX: In Fusion SDK (v1.0.5) that previous version of affxparser 
7 7
   used, a CDF file was never closed on Unix platforms (this bug was
... ...
@@ -10,6 +10,16 @@ o BUG FIX: In Fusion SDK (v1.0.5) that previous version of affxparser
10 10
   memory usage to blow up, when reading the same or different CDF
11 11
   files multiple times, because the memory was never deallocated.
12 12
   Thanks Seth Falcon and Ken Simpson for reporting this problem.
13
+o Windows build change: The Windows version is building against
14
+  the Windows code of Fusion SDK not the POSIX code. In order to do
15
+  this we have had to patch the preprocessor code in several of the
16
+  Fusion SDK source-code files, which has to be redone manually
17
+  whenever Fusion is updated.  Starting with this version, we instead 
18
+  set the _MSC_VER flag used in the Fusion code to indicate Windows
19
+  (set by the Microsoft Visual C++ compiler). Since we are using
20
+  MINGW this flag is obviously not set. Faking _MSC_VER this way
21
+  leaves us only having to patch one single file in the Fusion
22
+  release instead of 10-20. Hopefully there are no other side effects.
13 23
 
14 24
 Version: 1.7.0 [2006-10-25]
15 25
 o BUG FIX: writeCdf() would create an invalid CDF file if there were
... ...
@@ -36,11 +36,11 @@
36 36
   \code{"/usr/;usr/bin/;.;"}.
37 37
 }
38 38
 
39
-\section{Windows Shortcut links}{
40
-  If package \pkg{R.utils} is available, Windows Shortcut links (*.lnk)
41
-  are recognized and can be used to immitate links to directories
42
-  elsewhere.  For more details, see \code{\link[R.utils]{filePath}}.
43
-}
39
+% \section{Windows Shortcut links}{
40
+%   If package \pkg{R.utils} is available, Windows Shortcut links (*.lnk)
41
+%   are recognized and can be used to immitate links to directories
42
+%   elsewhere.  For more details, see \code{\link[R.utils]{filePath}}.
43
+% }
44 44
 
45 45
 \author{Henrik Bengtsson \url{http://www.braju.com/R/}}
46 46
 
... ...
@@ -16,7 +16,8 @@ PKG_CPPFLAGS+=\
16 16
  -Ifusion_sdk/calvin_files/writers/src\
17 17
  -Ifusion_sdk/file\
18 18
  -Ifusion_sdk/portability\
19
- -D_USE_MEM_MAPPING_
19
+ -D_USE_MEM_MAPPING_\
20
+ -D_MSC_VER
20 21
 
21 22
 SOURCES.fusion = \
22 23
 	fusion_sdk/calvin_files/data/src/CDFData.cpp\
... ...
@@ -174,7 +174,7 @@ extern "C" {
174 174
     int i_verboseFlag = INTEGER(verbose)[0];
175 175
 
176 176
     /** pointer to the name of the probeset. **/
177
-    const char* name;
177
+    char* name;
178 178
     char bfr[512];
179 179
 
180 180
     FusionCDFProbeSetInformation probeset;
... ...
@@ -234,11 +234,10 @@ extern "C" {
234 234
       /* Record its name */
235 235
       str = cdf.GetProbeSetName(iset);
236 236
       str_length = str.size();
237
-      cstr = Calloc(str_length+1, char);
238
-      strncpy(cstr, str.c_str(), str_length);
239
-      cstr[str_length] = '\0';
240
-      SET_STRING_ELT(names, ii, mkChar(cstr));
241
-      Free(cstr);
237
+      name = Calloc(str_length+1, char);
238
+      strncpy(name, str.c_str(), str_length);
239
+      name[str_length] = '\0';
240
+      SET_STRING_ELT(names, ii, mkChar(name));
242 241
       
243 242
       /* Get the number of groups in the unit */
244 243
       int ngroups = probeset.GetNumGroups();
... ...
@@ -282,7 +281,8 @@ extern "C" {
282 281
 
283 282
       /** pop the group list and group names of the stack. **/
284 283
       UNPROTECT(1);  /* 'r_group_names' */
285
-    }
284
+      Free(name);
285
+    } /* for (int ii=0 ...) */
286 286
     
287 287
     /** set the names down here at the end. **/
288 288
     setAttrib(probe_sets, R_NamesSymbol, names);
... ...
@@ -23,7 +23,7 @@
23 23
 
24 24
 using namespace affymetrix_calvin_io;
25 25
 
26
-#if !defined(_MSC_VER) && !defined(WIN32)
26
+#ifndef _MSC_VER
27 27
 #include <sys/mman.h>
28 28
 #endif
29 29
 
... ...
@@ -28,7 +28,6 @@ using namespace affymetrix_calvin_io;
28 28
 
29 29
 #ifndef _MSC_VER
30 30
 #include <unistd.h>
31
-#ifndef WIN32
32 31
 #include <sys/mman.h>
33 32
 
34 33
 #ifndef PAGE_SIZE
... ...
@@ -44,7 +43,6 @@ using namespace affymetrix_calvin_io;
44 43
 #define PAGE_TRUNC(ptr) (ptr&(PAGE_MASK))
45 44
 #endif
46 45
 #endif
47
-#endif
48 46
 
49 47
 /*
50 48
  * Initialize the object to use memory-mapping to access the file.
... ...
@@ -58,7 +56,7 @@ DataSet::DataSet(const std::string& fileName_, const DataSetHeader& header_, voi
58 56
 	data = 0;
59 57
 	isOpen = false;
60 58
 
61
-#if defined(_MSC_VER) || defined(WIN32)
59
+#ifdef _MSC_VER
62 60
 	fileMapHandle = handle;
63 61
 #else
64 62
 	fp = 0;
... ...
@@ -82,7 +80,7 @@ DataSet::DataSet(const std::string& fileName_, const affymetrix_calvin_io::DataS
82 80
 	data = 0;
83 81
 	isOpen = false;
84 82
 
85
-#if defined(_MSC_VER) || defined(WIN32)
83
+#ifdef _MSC_VER
86 84
 	fileMapHandle = 0;
87 85
 #else
88 86
 	fp = 0;
... ...
@@ -134,7 +132,7 @@ bool DataSet::Open()
134 132
  */
135 133
 bool DataSet::OpenMM()
136 134
 {
137
-#if defined(_MSC_VER) || defined(WIN32)
135
+#ifdef _MSC_VER
138 136
 	if (MapDataWin32(header.GetDataStartFilePos(), header.GetDataSize()) == false)
139 137
 		return false;
140 138
 #else
... ...
@@ -179,7 +177,7 @@ void DataSet::Close()
179 177
 		ClearStreamData();
180 178
 }
181 179
 
182
-#if defined(_MSC_VER) || defined(WIN32)
180
+#ifdef _MSC_VER
183 181
 
184 182
 std::string GetErrorMsg()
185 183
 {
... ...
@@ -291,7 +289,7 @@ bool DataSet::MapDataPosix(u_int32_t start, u_int32_t bytes)
291 289
  */
292 290
 void DataSet::UnmapFile()
293 291
 {
294
-#if defined(_MSC_VER) || defined(WIN32)
292
+#ifdef _MSC_VER
295 293
 
296 294
 	// Unmap the view
297 295
 	if (mappedData != 0 )
... ...
@@ -385,7 +383,7 @@ char* DataSet::FilePosition(int32_t rowStart, int32_t col, int32_t rowCount)
385 383
 	// Byte offset in data set + byte offset of data set in file
386 384
 	u_int32_t startByte = BytesPerRow()*rowStart + columnByteOffsets[col] + header.GetDataStartFilePos();
387 385
 
388
-#if defined(_MSC_VER) || defined(WIN32)
386
+#ifdef _MSC_VER
389 387
 
390 388
 	if (useMemoryMapping)
391 389
 	{
... ...
@@ -28,7 +28,7 @@
28 28
 #include <string>
29 29
 #include <fstream>
30 30
 
31
-#if defined(_MSC_VER) || defined(WIN32)
31
+#ifdef _MSC_VER
32 32
 #include <windows.h>
33 33
 #endif
34 34
 
... ...
@@ -272,7 +272,7 @@ protected:
272 272
 	int32_t LastRowMapped();
273 273
 
274 274
 	/*! Platform specific memory-mapping method */
275
-#if defined(_MSC_VER) || defined(WIN32)
275
+#ifdef _MSC_VER
276 276
 
277 277
 	bool MapDataWin32(u_int32_t start, u_int32_t bytes);
278 278
 
... ...
@@ -341,7 +341,7 @@ protected:
341 341
 	 */
342 342
 	Int32Vector columnByteOffsets;
343 343
 
344
-#if defined(_MSC_VER) || defined(WIN32)
344
+#ifdef _MSC_VER
345 345
 
346 346
 	/*! Handle returned by CreateFileMapping */
347 347
 	HANDLE fileMapHandle;
... ...
@@ -21,7 +21,7 @@
21 21
 #include "ParameterNameValueType.h"
22 22
 #include "StringUtils.h"
23 23
 
24
-#if defined(_MSC_VER) || defined(WIN32)
24
+#ifdef _MSC_VER
25 25
 #pragma warning(disable: 4996) // don't show deprecated warnings.
26 26
 #include <winsock2.h>
27 27
 #else
... ...
@@ -22,7 +22,7 @@
22 22
 #include <stdio.h>
23 23
 #include <stdlib.h>
24 24
 
25
-#if defined(_MSC_VER) || defined(WIN32)
25
+#ifdef _MSC_VER
26 26
 #include <winsock2.h>
27 27
 #pragma warning(disable: 4996)
28 28
 #else
... ...
@@ -25,7 +25,7 @@
25 25
 #include <stdio.h>
26 26
 #include <sstream>
27 27
 
28
-#if defined(_MSC_VER) || defined(WIN32)
28
+#ifdef _MSC_VER
29 29
 #pragma warning(disable: 4996) // ignore deprecated functions warning
30 30
 #include <winsock2.h>
31 31
 #include <process.h>
... ...
@@ -135,7 +135,7 @@ std::wstring StringUtils::ConvertMBSToWCS(const std::string& source)
135 135
  */
136 136
 std::wstring StringUtils::ToString(int value, int digits, wchar_t fill)
137 137
 {
138
-#if defined(_GLIBCPP_USE_WCHAR_T) || defined(_GLIBCXX_USE_WCHAR_T) || defined(_MSC_VER)
138
+#if !defined(__MINGW32__) && (defined(_GLIBCPP_USE_WCHAR_T) || defined(_GLIBCXX_USE_WCHAR_T) || defined(_MSC_VER))
139 139
 	std::wostringstream str;
140 140
 	str << std::setw(digits) << std::setfill(fill) << value;
141 141
 	return str.str();
... ...
@@ -26,7 +26,7 @@
26 26
 #include <math.h>
27 27
 #include <stdio.h>
28 28
 
29
-#if !defined(_MSC_VER) && !defined(WIN32)
29
+#ifndef _MSC_VER
30 30
 #include <sys/mman.h>
31 31
 #endif
32 32
 
... ...
@@ -75,7 +75,7 @@ CBPMAPFileData::CBPMAPFileData() :
75 75
 	m_bFileOpen(false),
76 76
 	m_bFileMapped(false)
77 77
 {
78
-#if defined(_MSC_VER) || defined(WIN32)
78
+#ifdef _MSC_VER
79 79
 	m_hFileMap = INVALID_HANDLE_VALUE;
80 80
 	m_hFile = INVALID_HANDLE_VALUE;
81 81
 #else
... ...
@@ -99,7 +99,7 @@ void CBPMAPFileData::Close()
99 99
 	m_NumberSequences = 0;
100 100
 	m_SequenceItems.erase(m_SequenceItems.begin(), m_SequenceItems.end());
101 101
 
102
-#if defined(_MSC_VER) || defined(WIN32)
102
+#ifdef _MSC_VER
103 103
 	if (m_bFileOpen)
104 104
 	{
105 105
 		if (m_bFileMapped)
... ...
@@ -439,7 +439,7 @@ bool CBPMAPFileData::ReadDataSection()
439 439
 	m_bFileOpen = false;
440 440
 	m_bFileMapped = false;
441 441
 
442
-#if defined(_MSC_VER) || defined(WIN32)
442
+#ifdef _MSC_VER
443 443
 
444 444
 	// Create the file.
445 445
 	m_hFile = CreateFile(m_FileName.c_str(), GENERIC_READ, FILE_SHARE_READ,
... ...
@@ -25,7 +25,7 @@
25 25
 
26 26
 //////////////////////////////////////////////////////////////////////
27 27
 
28
-#if defined(_MSC_VER) || defined(WIN32)
28
+#ifdef _MSC_VER
29 29
 #pragma warning(disable: 4786) // identifier was truncated in the debug information
30 30
 #include <windows.h>
31 31
 #endif
... ...
@@ -275,7 +275,7 @@ protected:
275 275
 
276 276
 	/*! Pointer to the data in the memory mapped file. */
277 277
 	char  *m_lpData;
278
-#if defined(_MSC_VER) || defined(WIN32)
278
+#ifdef _MSC_VER
279 279
 
280 280
 	/*! Windows handle to the file. */
281 281
 	HANDLE m_hFileMap;
... ...
@@ -28,7 +28,7 @@
28 28
 #include "CDFFileData.h"
29 29
 #include "FileIO.h"
30 30
 #include <stdio.h>
31
-#if !defined(_MSC_VER) && !defined(WIN32)
31
+#ifndef _MSC_VER
32 32
 #include <sys/mman.h>
33 33
 #endif
34 34
 
... ...
@@ -67,7 +67,7 @@ CCDFFileData::CCDFFileData() :
67 67
 	m_bFileOpen(false),
68 68
 	m_bFileMapped(false)
69 69
 {
70
-#if defined(_MSC_VER) || defined(WIN32)
70
+#ifdef _MSC_VER
71 71
 	m_hFileMap = INVALID_HANDLE_VALUE;
72 72
 	m_hFile = INVALID_HANDLE_VALUE;
73 73
 #else
... ...
@@ -409,7 +409,7 @@ void CCDFFileData::Close()
409 409
 	m_QCProbeSets.clear();
410 410
 	m_ProbeSetNames.Clear();
411 411
 
412
-#if defined(_MSC_VER) || defined(WIN32)
412
+#ifdef _MSC_VER
413 413
 	if (m_bFileOpen)
414 414
 	{
415 415
 		if (m_bFileMapped)
... ...
@@ -668,7 +668,7 @@ bool CCDFFileData::ReadXDAFormatUsingMemMap(bool bReadHeaderOnly)
668 668
 	m_bFileOpen = false;
669 669
 	m_bFileMapped = false;
670 670
 
671
-#if defined(_MSC_VER) || defined(WIN32)
671
+#ifdef _MSC_VER
672 672
 
673 673
 	// Create the file.
674 674
 	m_hFile = CreateFile(m_FileName.c_str(), GENERIC_READ, FILE_SHARE_READ,
... ...
@@ -26,7 +26,7 @@
26 26
 
27 27
 //////////////////////////////////////////////////////////////////////
28 28
 
29
-#if defined(_MSC_VER) || defined(WIN32)
29
+#ifdef _MSC_VER
30 30
 #pragma warning(disable: 4786) // identifier was truncated in the debug information
31 31
 #include <windows.h>
32 32
 #endif
... ...
@@ -748,7 +748,7 @@ protected:
748 748
 	/*! A pointer to data in a memory mapped file. */
749 749
 	char  *m_lpData;
750 750
 
751
-#if defined(_MSC_VER) || defined(WIN32)
751
+#ifdef _MSC_VER
752 752
 	/*! A windows handle used for memory mapping. */
753 753
 	HANDLE m_hFileMap;
754 754
 
... ...
@@ -29,7 +29,7 @@
29 29
 #include <iostream>
30 30
 #include <stdio.h>
31 31
 
32
-#if defined(_MSC_VER) || defined(WIN32)
32
+#ifdef _MSC_VER
33 33
 #pragma warning(disable: 4996) // don't show deprecated warnings.
34 34
 #ifdef HAVE_SNPRINTF // If not using visual c++'s _snprintf include snprintf.
35 35
 extern "C" {
... ...
@@ -94,12 +94,12 @@ using namespace affxcel;
94 94
 /// Size of compact cel format identifier
95 95
 #define CCEL_HEADER_LEN 8
96 96
 
97
-#if defined(_MSC_VER) || defined(WIN32)
98
-/// Line separator for Windows
99
-#define LINE_SEPARATOR "\r\n"
100
-#else
97
+#ifndef WIN32
101 98
 /// Line separator for unix/linux
102 99
 #define LINE_SEPARATOR "\n"
100
+#else
101
+/// Line separator for Windows
102
+#define LINE_SEPARATOR "\r\n"
103 103
 #endif
104 104
 
105 105
 #ifndef PAGE_SIZE
... ...
@@ -836,7 +836,7 @@ bool CCELFileData::ReadXDABCel(bool bReadHeaderOnly)
836 836
   //#if defined(_USE_MEM_MAPPING_)
837 837
 #ifndef _DONT_USE_MEM_MAPPING_
838 838
 
839
-#if defined(_MSC_VER) || defined(WIN32)
839
+#ifdef _MSC_VER
840 840
 	// Memory map file on windows...
841 841
 	SYSTEM_INFO info;
842 842
 	GetSystemInfo(&info);
... ...
@@ -1134,7 +1134,7 @@ bool CCELFileData::ReadTranscriptomeBCel(bool bReadHeaderOnly)
1134 1134
 	instr.close();
1135 1135
 
1136 1136
 	// Memory map file
1137
-#if defined(_MSC_VER) || defined(WIN32)
1137
+#ifdef _MSC_VER
1138 1138
 	SYSTEM_INFO info;
1139 1139
 	GetSystemInfo(&info);
1140 1140
 	m_hFile = CreateFile(m_FileName.c_str(), GENERIC_READ, FILE_SHARE_READ,
... ...
@@ -1359,7 +1359,7 @@ bool CCELFileData::ReadCompactBCel(bool bReadHeaderOnly)
1359 1359
 		return true;
1360 1360
 
1361 1361
 	// Memory map file
1362
-#if defined(_MSC_VER) || defined(WIN32)
1362
+#ifdef _MSC_VER
1363 1363
 	SYSTEM_INFO info;
1364 1364
 	GetSystemInfo(&info);
1365 1365
 	m_hFile = CreateFile(m_FileName.c_str(), GENERIC_READ, FILE_SHARE_READ,
... ...
@@ -1850,7 +1850,7 @@ void CCELFileData::Munmap()
1850 1850
 	m_pMeanIntensities = NULL;
1851 1851
 
1852 1852
 	// free the map
1853
-#if defined(_MSC_VER) || defined(WIN32)
1853
+#ifdef _MSC_VER
1854 1854
 	if (m_lpFileMap != NULL)
1855 1855
 	{
1856 1856
 		UnmapViewOfFile(m_lpFileMap);
... ...
@@ -38,7 +38,7 @@
38 38
 ///  Set page mask value for memory mapping used under CYGWIN
39 39
 #define PAGE_MASK	(~(PAGE_SIZE-1))
40 40
 
41
-#elif defined (_MSC_VER) || defined (WIN32)
41
+#elif defined (_MSC_VER)
42 42
 #include <windows.h>
43 43
 ///  Structure alignment requirement for g++
44 44
 ///  @remark Structure alignment for Visual C++ is included in #pragma
... ...
@@ -70,7 +70,7 @@
70 70
 namespace affxcel
71 71
 {
72 72
 
73
-#if defined(_MSC_VER) || defined(WIN32)
73
+#ifdef _MSC_VER 
74 74
 #pragma pack(push, 1)
75 75
 #endif
76 76
 ///////////////////////////////////////////////////////////////////////////////
... ...
@@ -101,7 +101,7 @@ typedef struct _CELFileTranscriptomeEntryType
101 101
 	unsigned char Pixels /* \cond */ STRUCT_ALIGNMENT /*! \endcond */ ;
102 102
 } CELFileTranscriptomeEntryType;
103 103
 
104
-#if defined(_MSC_VER) || defined(WIN32)
104
+#ifdef _MSC_VER
105 105
 #pragma pack(pop)
106 106
 #endif
107 107
 
... ...
@@ -567,7 +567,7 @@ protected:
567 567
 	/// Flag to determine if outlier data should be read
568 568
 	bool m_bReadOutliers;
569 569
 
570
-#if defined(_MSC_VER) || defined(WIN32)
570
+#ifdef _MSC_VER
571 571
 	/// File handle used by CreateFileMapping in _MSC_VER
572 572
 	HANDLE m_hFile;
573 573
 	/// File map handle used by MapViewOfFile in _MSC_VER
... ...
@@ -27,7 +27,7 @@
27 27
 
28 28
 //////////////////////////////////////////////////////////////////////
29 29
 
30
-#if defined(_MSC_VER) || defined(WIN32)
30
+#ifdef _MSC_VER
31 31
 #pragma warning(disable: 4996) // don't show deprecated warnings.
32 32
 #include <winsock2.h>
33 33
 #else
... ...
@@ -26,7 +26,7 @@
26 26
 
27 27
 //////////////////////////////////////////////////////////////////////
28 28
 
29
-#if defined(_MSC_VER) || defined(WIN32)
29
+#ifdef _MSC_VER
30 30
 #include <winsock2.h>
31 31
 #else
32 32
 #include <inttypes.h>