ENH: Moved kwsys_ns and kwsysEXPORT macros to Configure.h in the case of building a kwsys source file. This allows more than one header to be included in a kwsys source file without redefining the macros.

This commit is contained in:
Brad King 2005-07-26 11:34:57 -04:00
parent 5b26fefd60
commit b9d472d81d
4 changed files with 19 additions and 8 deletions

View File

@ -11,7 +11,6 @@
PURPOSE. See the above copyright notices for more information. PURPOSE. See the above copyright notices for more information.
=========================================================================*/ =========================================================================*/
#define KWSYS_IN_BASE64_C
#include "kwsysPrivate.h" #include "kwsysPrivate.h"
#include KWSYS_HEADER(Base64.h) #include KWSYS_HEADER(Base64.h)

View File

@ -20,8 +20,10 @@
namespace. These macros are used internally to kwsys only, and are namespace. These macros are used internally to kwsys only, and are
not visible to user code. Use kwsysHeaderDump.pl to reproduce not visible to user code. Use kwsysHeaderDump.pl to reproduce
these macros after making changes to the interface. */ these macros after making changes to the interface. */
#define kwsys_ns(x) @KWSYS_NAMESPACE@##x #if !defined(KWSYS_NAMESPACE)
#define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT # define kwsys_ns(x) @KWSYS_NAMESPACE@##x
# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
#endif
#define kwsysBase64 kwsys_ns(Base64) #define kwsysBase64 kwsys_ns(Base64)
#define kwsysBase64_Decode kwsys_ns(Base64_Decode) #define kwsysBase64_Decode kwsys_ns(Base64_Decode)
#define kwsysBase64_Decode3 kwsys_ns(Base64_Decode3) #define kwsysBase64_Decode3 kwsys_ns(Base64_Decode3)
@ -99,9 +101,9 @@ kwsysEXPORT unsigned long kwsysBase64_Decode(const unsigned char *input,
} /* extern "C" */ } /* extern "C" */
#endif #endif
/* If we are building Base64.c, let it use these macros. Otherwise, /* If we are building a kwsys .c or .cxx file, let it use these macros.
undefine them to keep the namespace clean. */ Otherwise, undefine them to keep the namespace clean. */
#if !defined(KWSYS_IN_BASE64_C) #if !defined(KWSYS_NAMESPACE)
# undef kwsys_ns # undef kwsys_ns
# undef kwsysEXPORT # undef kwsysEXPORT
# undef kwsysBase64 # undef kwsysBase64

View File

@ -14,6 +14,14 @@
#ifndef @KWSYS_NAMESPACE@_Configure_h #ifndef @KWSYS_NAMESPACE@_Configure_h
#define @KWSYS_NAMESPACE@_Configure_h #define @KWSYS_NAMESPACE@_Configure_h
/* If we are building a kwsys .c or .cxx file, let it use the kwsys
namespace. When not building a kwsys source file these macros are
temporarily defined inside the headers that use them. */
#if defined(KWSYS_NAMESPACE)
# define kwsys_ns(x) @KWSYS_NAMESPACE@##x
# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
#endif
/* Setup the export macro. */ /* Setup the export macro. */
#if defined(_WIN32) && @KWSYS_BUILD_SHARED@ #if defined(_WIN32) && @KWSYS_BUILD_SHARED@
# if defined(@KWSYS_NAMESPACE@_EXPORTS) # if defined(@KWSYS_NAMESPACE@_EXPORTS)

View File

@ -20,8 +20,10 @@
namespace. These macros are used internally to kwsys only, and are namespace. These macros are used internally to kwsys only, and are
not visible to user code. Use kwsysHeaderDump.pl to reproduce not visible to user code. Use kwsysHeaderDump.pl to reproduce
these macros after making changes to the interface. */ these macros after making changes to the interface. */
#define kwsys_ns(x) @KWSYS_NAMESPACE@##x #if !defined(KWSYS_NAMESPACE)
#define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT # define kwsys_ns(x) @KWSYS_NAMESPACE@##x
# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
#endif
#define kwsysProcess kwsys_ns(Process) #define kwsysProcess kwsys_ns(Process)
#define kwsysProcess_s kwsys_ns(Process_s) #define kwsysProcess_s kwsys_ns(Process_s)
#define kwsysProcess_New kwsys_ns(Process_New) #define kwsysProcess_New kwsys_ns(Process_New)