From 8b0d3c6c373474dc31af9eb56cf949298a723a76 Mon Sep 17 00:00:00 2001 From: malaterre Date: Mon, 26 Apr 2004 00:27:53 +0000 Subject: [PATCH] ENH: Remove redundancie about GDCM_DICT stuff, now we only need to modify one file instead of seven + some small cleanup --- CMakeLists.txt | 26 ++++++++++++++++++++++++ ChangeLog | 6 +++--- Testing/CMakeLists.txt | 10 +++++----- Testing/TestBug.cxx | 1 - Testing/TestDicomDir.cxx | 1 - gdcmConfigure.h.in | 10 ++++++++++ src/CMakeLists.txt | 40 +------------------------------------ src/gdcmCommon.h | 29 ++++++++++++++++++++++++--- src/gdcmDicomDirElement.cxx | 10 ---------- src/gdcmDict.cxx | 7 ------- src/gdcmDictSet.cxx | 6 ------ src/gdcmDirList.cxx | 7 ------- src/gdcmHeaderEntry.cxx | 6 ------ src/gdcmParser.cxx | 16 +++++---------- src/gdcmParser.h | 3 +++ src/gdcmTS.cxx | 10 ---------- src/gdcmVR.cxx | 11 ---------- 17 files changed, 79 insertions(+), 120 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddb8a400..c253b701 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,6 +63,32 @@ FIND_PATH(GDCM_DATA_ROOT gdcm-ACR-LibIDO.acr # Deals with problem on SunOS: # ostrstream vs. ostringstream +#----------------------------------------------------------------------------- +# Why one should not use ADD_DEFINITIONS +# http://www.cmake.org/pipermail/cmake/2003-September/004286.html + +#----------------------------------------------------------------------------- +# __STDC_LIMIT_MACROS -> Refer to stdint.h +# http://www.cmake.org/pipermail/cmake/2003-October/004369.html +# http://www.cmake.org/pipermail/cmake/2003-October/004373.html + +#SET(GDCM_COMPILE_FLAGS "-D__STDC_LIMIT_MACROS -DPUB_DICT_PATH=\\\"${CMAKE_INSTALL_PREFIX}${GDCM_DATA_DIR}\\\"" ) + +SET( GDCM_PUB_DICT_PATH "${CMAKE_INSTALL_PREFIX}${GDCM_DATA_DIR}") + +# SunOS + old gcc fixes: +INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake) +IF(CMAKE_NO_ANSI_STRING_STREAM) + SET(GDCM_NO_ANSI_STRING_STREAM 1) +ENDIF(CMAKE_NO_ANSI_STRING_STREAM) + +INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) +CHECK_INCLUDE_FILE("stdint.h" CMAKE_HAVE_STDINT_H) + +IF(NOT CMAKE_HAVE_STDINT_H) + SET(GDCM_HAVE_NO_STDINT_H 1) +ENDIF(NOT CMAKE_HAVE_STDINT_H) + #SET(GDCM_NO_ANSI_STRING_STREAM # ${CMAKE_NO_ANSI_STRING_STREAM} #) diff --git a/ChangeLog b/ChangeLog index d2c05cab..f0191743 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,12 @@ -2004-04-25 Mathieu Malaterre - * ENH: Adding a GDCM_DATA_ROOT for testing - 2004-04-25 Mathieu Malaterre * ENH: Adding automatic testing 1. Need a DartConfig.cmake to submit to public 2. Add a test driver gdcmTest.cxx 3. gdcmTestMain, an helper for the main test driver gdcmTest 4. Files in Test don't have a main anymore, this becomes intersting when we add more and more tests, thus dsw don't have to load too many projects + * ENH: Adding a GDCM_DATA_ROOT for testing + * ENH: Remove redundancie about GDCM_DICT stuff, now we only need to modify + one file instead of seven + some small cleanup 2004-04-22 Jean-Pierre Roux * ENH Minor changes to the Print() methods diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt index f722013e..feb6a090 100644 --- a/Testing/CMakeLists.txt +++ b/Testing/CMakeLists.txt @@ -6,12 +6,12 @@ SET(CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH}) SET(GDCM_TESTS ${CXX_TEST_PATH}/gdcmTests) -INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) -CHECK_INCLUDE_FILE("stdint.h" CMAKE_HAVE_STDINT_H) +#INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) +#CHECK_INCLUDE_FILE("stdint.h" CMAKE_HAVE_STDINT_H) -IF(NOT CMAKE_HAVE_STDINT_H) - SET(GDCM_TEST_COMPILE_FLAGS "-DHAVE_NO_STDINT_H") -ENDIF(NOT CMAKE_HAVE_STDINT_H) +#IF(NOT CMAKE_HAVE_STDINT_H) +# SET(GDCM_TEST_COMPILE_FLAGS "-DHAVE_NO_STDINT_H") +#ENDIF(NOT CMAKE_HAVE_STDINT_H) SET(TEST_SOURCES diff --git a/Testing/TestBug.cxx b/Testing/TestBug.cxx index 7126585c..b71e660e 100644 --- a/Testing/TestBug.cxx +++ b/Testing/TestBug.cxx @@ -1,6 +1,5 @@ // The following crashes on Win32 #include "gdcm.h" -#include "gdcmConfigure.h" int bug1(int argc, char* argv[]) { diff --git a/Testing/TestDicomDir.cxx b/Testing/TestDicomDir.cxx index 4de300aa..1cccb798 100644 --- a/Testing/TestDicomDir.cxx +++ b/Testing/TestDicomDir.cxx @@ -2,7 +2,6 @@ #include "gdcm.h" #include "gdcmHeaderEntry.h" #include "gdcmDicomDir.h" -#include "gdcmConfigure.h" #include #ifdef GDCM_NO_ANSI_STRING_STREAM diff --git a/gdcmConfigure.h.in b/gdcmConfigure.h.in index ad1abfd0..8d856d4b 100644 --- a/gdcmConfigure.h.in +++ b/gdcmConfigure.h.in @@ -1 +1,11 @@ +#define __STDC_LIMIT_MACROS + +#define PUB_DICT_PATH "@GDCM_PUB_DICT_PATH@" + #define GDCM_DATA_ROOT "@GDCM_DATA_ROOT@" + +#cmakedefine GDCM_NO_ANSI_STRING_STREAM + +#cmakedefine HAVE_NO_STDINT_H + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6bd5a093..1ccabed4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,6 +7,7 @@ INCLUDE_DIRECTORIES( ${GDCM_SOURCE_DIR}/src/jpeg/libijg8 #${GDCM_SOURCE_DIR}/jpeg/libijg12 #all files have been renamed, appending 12 #${GDCM_SOURCE_DIR}/jpeg/ljpg # JPEG lib from xmedcom + ${GDCM_BINARY_DIR}/ #for gdcmConfigure.h ) SET(libgdcm_la_SOURCES @@ -39,45 +40,6 @@ SET(libgdcm_la_SOURCES gdcmUtil.cxx gdcmVR.cxx ) -#----------------------------------------------------------------------------- -# Why one should not use ADD_DEFINITIONS -# http://www.cmake.org/pipermail/cmake/2003-September/004286.html - -#----------------------------------------------------------------------------- -# __STDC_LIMIT_MACROS -> Refer to stdint.h -# http://www.cmake.org/pipermail/cmake/2003-October/004369.html -# http://www.cmake.org/pipermail/cmake/2003-October/004373.html - -SET(GDCM_COMPILE_FLAGS - "-D__STDC_LIMIT_MACROS -DPUB_DICT_PATH=\\\"${CMAKE_INSTALL_PREFIX}${GDCM_DATA_DIR}\\\"" - ) - -# SunOS + old gcc fixes: - -INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake) -IF(CMAKE_NO_ANSI_STRING_STREAM) -SET(GDCM_COMPILE_FLAGS - "${GDCM_COMPILE_FLAGS} -DGDCM_NO_ANSI_STRING_STREAM" - ) -ENDIF(CMAKE_NO_ANSI_STRING_STREAM) - -#INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake) -#INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) - -INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) -CHECK_INCLUDE_FILE("stdint.h" CMAKE_HAVE_STDINT_H) - -#MESSAGE(STATUS ${CMAKE_NO_ANSI_STRING_STREAM}) -IF(NOT CMAKE_HAVE_STDINT_H) -SET(GDCM_COMPILE_FLAGS - "${GDCM_COMPILE_FLAGS} -DHAVE_NO_STDINT_H" - ) -ENDIF(NOT CMAKE_HAVE_STDINT_H) - -SET_SOURCE_FILES_PROPERTIES(${libgdcm_la_SOURCES} - PROPERTIES - COMPILE_FLAGS ${GDCM_COMPILE_FLAGS} -) ADD_LIBRARY(gdcm ${libgdcm_la_SOURCES} ) IF(UNIX) diff --git a/src/gdcmCommon.h b/src/gdcmCommon.h index 173fba77..2b42c8cd 100644 --- a/src/gdcmCommon.h +++ b/src/gdcmCommon.h @@ -3,6 +3,8 @@ #ifndef GDCMCOMMON_H #define GDCMCOMMON_H +#include "gdcmConfigure.h" + //----------------------------------------------------------------------------- //This is needed when compiling in debug mode #ifdef _MSC_VER @@ -29,7 +31,12 @@ //----------------------------------------------------------------------------- #ifdef __GNUC__ #ifndef HAVE_NO_STDINT_H +//#if defined __STDC_LIMIT_MACROS +//#endif #include +//#ifdef UINT32_MAX +//#error hehrehhehehehe2 +//#endif #define guint16 uint16_t #define guint32 uint32_t #define gint16 int16_t @@ -58,6 +65,25 @@ typedef int gint32; #define GDCM_EXPORT #endif +// ifdef for old gcc / broken compiler +#ifdef GDCM_NO_ANSI_STRING_STREAM +# include +# define ostringstream ostrstream +# else +# include +#endif + + +// Centralize information about the gdcm dictionary in only one file: +#ifndef PUB_DICT_PATH +# define PUB_DICT_PATH "../Dicts/" +#endif +#define PUB_DICT_NAME "DicomV3Dict" +#define PUB_DICT_FILENAME "dicomV3.dic" +#define DICT_ELEM "DicomDir.dic" +#define DICT_TS "dicomTS.dic" +#define DICT_VR "dicomVR.dic" + #include const std::string GDCM_UNFOUND = "gdcm::Unfound"; @@ -73,8 +99,5 @@ enum FileType { ACR_LIBIDO }; -//For now gdcm is not willing cmake, try to be more quiet -//#cmakedefine GDCM_NO_ANSI_STRING_STREAM - //----------------------------------------------------------------------------- #endif diff --git a/src/gdcmDicomDirElement.cxx b/src/gdcmDicomDirElement.cxx index e9558e9b..f0f82ed1 100644 --- a/src/gdcmDicomDirElement.cxx +++ b/src/gdcmDicomDirElement.cxx @@ -3,22 +3,12 @@ #include #include // For sprintf #include -#ifdef GDCM_NO_ANSI_STRING_STREAM -# include -# define ostringstream ostrstream -# else -# include -#endif #include "gdcmDicomDirElement.h" #include "gdcmUtil.h" #include "gdcmDebug.h" #include "gdcmDictSet.h" -#ifndef PUB_DICT_PATH -# define PUB_DICT_PATH "../Dicts/" -#endif -#define DICT_ELEM "DicomDir.dic" /** * \ingroup gdcmDicomDirElement diff --git a/src/gdcmDict.cxx b/src/gdcmDict.cxx index fd3e990c..7d9585cd 100644 --- a/src/gdcmDict.cxx +++ b/src/gdcmDict.cxx @@ -8,13 +8,6 @@ #include #include -#ifdef GDCM_NO_ANSI_STRING_STREAM -# include -# define ostringstream ostrstream -# else -# include -#endif - //----------------------------------------------------------------------------- // Constructor / Destructor /** diff --git a/src/gdcmDictSet.cxx b/src/gdcmDictSet.cxx index e2c12ef4..0a407bb4 100644 --- a/src/gdcmDictSet.cxx +++ b/src/gdcmDictSet.cxx @@ -5,12 +5,6 @@ #include #include // For getenv -#define PUB_DICT_NAME "DicomV3Dict" -#ifndef PUB_DICT_PATH -# define PUB_DICT_PATH "../Dicts/" -#endif -#define PUB_DICT_FILENAME "dicomV3.dic" - //----------------------------------------------------------------------------- // Constructor / Destructor /** diff --git a/src/gdcmDirList.cxx b/src/gdcmDirList.cxx index f49c0ba9..265f4b4f 100644 --- a/src/gdcmDirList.cxx +++ b/src/gdcmDirList.cxx @@ -6,13 +6,6 @@ #include #include -#ifdef GDCM_NO_ANSI_STRING_STREAM - #include - #define ostringstream ostrstream -#else - #include -#endif - #ifdef _MSC_VER #include #include diff --git a/src/gdcmHeaderEntry.cxx b/src/gdcmHeaderEntry.cxx index fef886cb..b445b624 100644 --- a/src/gdcmHeaderEntry.cxx +++ b/src/gdcmHeaderEntry.cxx @@ -6,12 +6,6 @@ #include "gdcmGlobal.h" #include "gdcmUtil.h" -#ifdef GDCM_NO_ANSI_STRING_STREAM -# include -# define ostringstream ostrstream -# else -# include -#endif #include // for std::ios::left, ... diff --git a/src/gdcmParser.cxx b/src/gdcmParser.cxx index 14ed1564..327a3753 100644 --- a/src/gdcmParser.cxx +++ b/src/gdcmParser.cxx @@ -1,5 +1,10 @@ // gdcmParser.cxx //----------------------------------------------------------------------------- +#include "gdcmParser.h" +#include "gdcmGlobal.h" +#include "gdcmUtil.h" +#include "gdcmDebug.h" + #include #include @@ -10,19 +15,8 @@ #include #endif -#ifdef GDCM_NO_ANSI_STRING_STREAM -# include -# define ostringstream ostrstream -# else -# include -#endif # include -#include "gdcmParser.h" -#include "gdcmGlobal.h" -#include "gdcmUtil.h" -#include "gdcmDebug.h" - #define UI1_2_840_10008_1_2 "1.2.840.10008.1.2" #define UI1_2_840_10008_1_2_1 "1.2.840.10008.1.2.1" #define UI1_2_840_10008_1_2_2 "1.2.840.10008.1.2.2" diff --git a/src/gdcmParser.h b/src/gdcmParser.h index 239ff644..1b07a174 100644 --- a/src/gdcmParser.h +++ b/src/gdcmParser.h @@ -4,6 +4,7 @@ #define GDCMPARSER_H #include "gdcmCommon.h" + #include "gdcmVR.h" #include "gdcmTS.h" #include "gdcmException.h" @@ -13,6 +14,8 @@ #include #include + + //----------------------------------------------------------------------------- typedef std::string VRKey; typedef std::string VRAtr; diff --git a/src/gdcmTS.cxx b/src/gdcmTS.cxx index 8946c61a..0712d1db 100644 --- a/src/gdcmTS.cxx +++ b/src/gdcmTS.cxx @@ -3,22 +3,12 @@ #include #include #include -#ifdef GDCM_NO_ANSI_STRING_STREAM -# include -# define ostringstream ostrstream -# else -# include -#endif #include "gdcmTS.h" #include "gdcmDebug.h" #include "gdcmUtil.h" #include "gdcmDictSet.h" -#ifndef PUB_DICT_PATH -# define PUB_DICT_PATH "../Dicts/" -#endif -#define DICT_TS "dicomTS.dic" //----------------------------------------------------------------------------- diff --git a/src/gdcmVR.cxx b/src/gdcmVR.cxx index 536aea36..9a709168 100644 --- a/src/gdcmVR.cxx +++ b/src/gdcmVR.cxx @@ -3,23 +3,12 @@ #include #include -#ifdef GDCM_NO_ANSI_STRING_STREAM -# include -# define ostringstream ostrstream -# else -# include -#endif #include "gdcmVR.h" #include "gdcmUtil.h" #include "gdcmDictSet.h" #include "gdcmDebug.h" -#ifndef PUB_DICT_PATH -# define PUB_DICT_PATH "../Dicts/" -#endif -#define DICT_VR "dicomVR.dic" - //----------------------------------------------------------------------------- /** * \brief Constructor -- 2.45.1