From: navarrop Date: Fri, 18 Jun 2010 14:26:29 +0000 (+0000) Subject: Define correctly variables for windows. X-Git-Tag: v3_5~906 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/7eef625065d0b3af4a64b5665009491426db974f Define correctly variables for windows. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7903 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c375a7c4e3..eb72ca5f77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,15 @@ if(EXISTS /usr/include/) set(INCLUDES "${INCLUDES} -I/usr/include/") endif(EXISTS /usr/include/) +### Check 32bits or 64bits +INCLUDE (CheckTypeSize) +CHECK_TYPE_SIZE("long" SIZEOF_LONG) +IF(SIZEOF_LONG EQUAL 4) + SET(ARCH_32_BITS 1) +ELSE(SIZEOF_LONG EQUAL 4) + SET(ARCH_32_BITS 0) +ENDIF(SIZEOF_LONG EQUAL 4) + if(WIN32) set(INCLUDES_MORE $ENV{INCLUDE}) string(REPLACE "\\" "/" INCLUDES_MORE "${INCLUDES_MORE}") @@ -43,7 +52,20 @@ if(WIN32) message(" -- INCLUDES ${INCLUDES}\n\n") set(__STRICT_ANSI__ 1) set(_MSC_VER 1) - set(_WIN32 1) + set(_XBT_WIN32 1) + if(BORLAND) ### BORLAND COMPILER + set(__BORLANDC__ 1) + set(_XBT_BORLANDC_COMPILER 1) + endif(BORLAND) + if(MSVC_VERSION) ### MicroSoftVisualC COMPILER + set(__VISUALC__ 1) + set(_XBT_VISUALC_COMPILER 1) + endif(MSVC_VERSION) + if(ARCH_32_BITS) ### Arch 32bits + set(_WIN32 1) + else(ARCH_32_BITS) ### Arch 64bits + set(_WIN64 1) + endif(ARCH_32_BITS) endif(WIN32) add_definitions (${INCLUDES}) diff --git a/buildtools/Cmake/AddTests.cmake b/buildtools/Cmake/AddTests.cmake index a652958ef2..5cdbd8c886 100644 --- a/buildtools/Cmake/AddTests.cmake +++ b/buildtools/Cmake/AddTests.cmake @@ -36,15 +36,6 @@ SET(VALGRIND_COMMAND "${PROJECT_DIRECTORY}/buildtools/Cmake/my_valgrind.pl") SET(MEMORYCHECK_COMMAND "${PROJECT_DIRECTORY}/buildtools/Cmake/my_valgrind.pl") #If you use the --read-var-info option Memcheck will run more slowly but may give a more detailed description of any illegal address. -### Check 32bits or 64bits -INCLUDE (CheckTypeSize) -CHECK_TYPE_SIZE("long" SIZEOF_LONG) -IF(SIZEOF_LONG EQUAL 4) - SET(ARCH_32_BITS 1) -ELSE(SIZEOF_LONG EQUAL 4) - SET(ARCH_32_BITS 0) -ENDIF(SIZEOF_LONG EQUAL 4) - INCLUDE(CTest) ENABLE_TESTING() diff --git a/buildtools/Cmake/CompleteInFiles.cmake b/buildtools/Cmake/CompleteInFiles.cmake index 5c6e95a983..d585f96d8b 100644 --- a/buildtools/Cmake/CompleteInFiles.cmake +++ b/buildtools/Cmake/CompleteInFiles.cmake @@ -481,7 +481,7 @@ if(HAVE_MAKECONTEXT OR WIN32) endif(CMAKE_SYSTEM_NAME MATCHES "Darwin") if(WIN32) - set(makecontext_CPPFLAGS_2 "-DWIN32 ${INCLUDES}") + set(makecontext_CPPFLAGS_2 "-D_XBT_WIN32 ${INCLUDES}") endif(WIN32) try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR diff --git a/buildtools/Cmake/MaintainerMode.cmake b/buildtools/Cmake/MaintainerMode.cmake index 9fec712c61..43c5e9f31a 100644 --- a/buildtools/Cmake/MaintainerMode.cmake +++ b/buildtools/Cmake/MaintainerMode.cmake @@ -63,19 +63,19 @@ exec_program("${FLEX_EXE} -o src/gras/DataDesc/ddt_parse.yy.c -Pgras_ddt_parse_ #surf/simgrid_dtd.c: surf/simgrid_dtd.l exec_program("${CMAKE_COMMAND} -E make_directory ${PROJECT_DIRECTORY}/src/surf") exec_program("${FLEX_EXE} -o src/surf/simgrid_dtd.c -Psurf_parse_ --noline src/surf/simgrid_dtd.l" "${PROJECT_DIRECTORY}/") -set(CHAINE "'s/#include /#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)\\n# ifndef __STRICT_ANSI__\\n# include \\n# include \\n# endif\\n#else\\n# include \\n#endif/g' -i src/surf/simgrid_dtd.c") +set(CHAINE "'s/#include /#if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)\\n# ifndef __STRICT_ANSI__\\n# include \\n# include \\n# endif\\n#else\\n# include \\n#endif/g' -i src/surf/simgrid_dtd.c") exec_program("${SED_EXE} ${CHAINE}" "${PROJECT_DIRECTORY}") #xbt/graphxml.c: xbt/graphxml.l exec_program("${CMAKE_COMMAND} -E make_directory ${PROJECT_DIRECTORY}/src/xbt") exec_program("${FLEX_EXE} -o src/xbt/graphxml.c -Pxbt_graph_parse_ --noline src/xbt/graphxml.l" "${PROJECT_DIRECTORY}") -set(CHAINE "'s/#include /#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)\\n# ifndef __STRICT_ANSI__\\n# include \\n# include \\n# endif\\n#else\\n# include \\n#endif/g' -i src/xbt/graphxml.c") +set(CHAINE "'s/#include /#if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)\\n# ifndef __STRICT_ANSI__\\n# include \\n# include \\n# endif\\n#else\\n# include \\n#endif/g' -i src/xbt/graphxml.c") exec_program("${SED_EXE} ${CHAINE}" "${PROJECT_DIRECTORY}") #simdag/dax_dtd.c: simdag/dax_dtd.l exec_program("${CMAKE_COMMAND} -E make_directory ${PROJECT_DIRECTORY}/src/simdag") exec_program("${FLEX_EXE} -o src/simdag/dax_dtd.c -Pdax_ --noline src/simdag/dax_dtd.l" "${PROJECT_DIRECTORY}") -set(CHAINE "'s/#include /#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)\\n# ifndef __STRICT_ANSI__\\n# include \\n# include \\n# endif\\n#else\\n# include \\n#endif/g' -i src/simdag/dax_dtd.c") +set(CHAINE "'s/#include /#if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)\\n# ifndef __STRICT_ANSI__\\n# include \\n# include \\n# endif\\n#else\\n# include \\n#endif/g' -i src/simdag/dax_dtd.c") exec_program("${SED_EXE} ${CHAINE}" "${PROJECT_DIRECTORY}") elseif(HAVE_FLEXML AND HAVE_FLEX AND SED_EXE) diff --git a/buildtools/Cmake/MakeExeLib.cmake b/buildtools/Cmake/MakeExeLib.cmake index 9599930f7a..338ff0f96a 100644 --- a/buildtools/Cmake/MakeExeLib.cmake +++ b/buildtools/Cmake/MakeExeLib.cmake @@ -1,10 +1,10 @@ ### Make Libs if(WIN32) foreach(file ${simgrid_sources}) - set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS "/D DLL_EXPORT") + set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS "/D _XBT_DLL_EXPORT") endforeach(file ${simgrid_sources}) foreach(file ${gras_sources}) - set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS "/D DLL_EXPORT") + set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS "/D _XBT_DLL_EXPORT") endforeach(file ${gras_sources}) endif(WIN32) diff --git a/buildtools/Cmake/gras_config.h.in b/buildtools/Cmake/gras_config.h.in index 4cdeafdd8e..7902f1b167 100644 --- a/buildtools/Cmake/gras_config.h.in +++ b/buildtools/Cmake/gras_config.h.in @@ -2,21 +2,26 @@ // With Cmake it creates /src/gras_config.h /* Set somes variables for Windows compilation */ + +#ifdef _XBT_DLL_EXPORT + #define DLL_EXPORT +#else + #define DLL_IMPORT +#endif + #ifndef __STRICT_ANSI__ #cmakedefine __STRICT_ANSI__ @__STRICT_ANSI__@ #endif #ifndef _MSC_VER #cmakedefine _MSC_VER @_MSC_VER@ #endif -#ifndef _WIN32 - #cmakedefine _WIN32 @_WIN32@ -#endif -#ifndef WIN32 - #cmakedefine WIN32 @WIN32@ -#endif -#ifdef _WIN32 - #define __VISUALC__ -#endif +#cmakedefine _XBT_WIN32 @_XBT_WIN32@ //this variable is set if it is a windows platform +#cmakedefine _WIN32 @_WIN32@ //this variable is set if it is a 32 bits windows platform +#cmakedefine _WIN64 @_WIN64@ //this variable is set if it is a 64 bits windows platform +#cmakedefine __VISUALC__ @__VISUALC__@ +#cmakedefine __BORLANDC__ @__BORLANDC__@ +#cmakedefine _XBT_VISUALC_COMPILER @_XBT_VISUALC_COMPILER@ +#cmakedefine _XBT_BORLANDC_COMPILER @_XBT_BORLANDC_COMPILER@ /* Set to true if enable_model-checking is true */ #cmakedefine MMALLOC_WANT_OVERIDE_LEGACY @MMALLOC_WANT_OVERIDE_LEGACY@ diff --git a/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c b/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c index 589c3fe64a..a0a73373c8 100644 --- a/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c +++ b/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c @@ -6,7 +6,7 @@ #include #include -#ifdef _WIN32 +#ifdef _XBT_WIN32 #include #else #include diff --git a/buildtools/Cmake/test_prog/prog_stacksetup.c b/buildtools/Cmake/test_prog/prog_stacksetup.c index b5f7706695..55936ed623 100644 --- a/buildtools/Cmake/test_prog/prog_stacksetup.c +++ b/buildtools/Cmake/test_prog/prog_stacksetup.c @@ -8,7 +8,7 @@ #define _XOPEN_SOURCE #endif -#ifdef WIN32 +#ifdef _XBT_WIN32 #include "win32_ucontext.h" #include "win32_ucontext.c" #endif diff --git a/include/simgrid_config.h.in b/include/simgrid_config.h.in index 35e54e4a00..8985e0f641 100644 --- a/include/simgrid_config.h.in +++ b/include/simgrid_config.h.in @@ -8,7 +8,10 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "xbt/misc.h" /* XBT_PUBLIC */ -#ifndef DLL_EXPORT + +#ifdef _XBT_DLL_EXPORT + #define DLL_EXPORT +#else #define DLL_IMPORT #endif diff --git a/include/xbt/log.h b/include/xbt/log.h index 77f036b609..09f539f5db 100644 --- a/include/xbt/log.h +++ b/include/xbt/log.h @@ -241,7 +241,7 @@ XBT_PUBLIC(void) xbt_log_control_set(const char *cs); /* * Do NOT access any members of this structure directly. FIXME: move to private? */ -#ifdef WIN32 +#ifdef _XBT_WIN32 #define XBT_LOG_BUFF_SIZE 16384 /* Size of the static string in which we build the log string */ #else #define XBT_LOG_BUFF_SIZE 2048 /* Size of the static string in which we build the log string */ @@ -266,7 +266,7 @@ XBT_PUBLIC(void) xbt_log_control_set(const char *cs); int lineNum; va_list ap; va_list ap_copy; /* need a copy to launch dynamic layouts when the static ones overflowed */ -#ifdef WIN32 +#ifdef _XBT_WIN32 char *buffer; #else char buffer[XBT_LOG_BUFF_SIZE]; @@ -389,7 +389,7 @@ XBT_PUBLIC_DATA(s_xbt_log_category_t) _XBT_LOGV(XBT_LOG_ROOT_CAT); * code. * Setting the LogEvent's valist member is done inside _log_logEvent. */ -#ifdef WIN32 +#ifdef _XBT_WIN32 #define _XBT_LOG_PRE(catv, priority) do { \ if (_XBT_LOG_ISENABLEDV(catv, priority)) { \ s_xbt_log_event_t _log_ev = \ diff --git a/include/xbt/misc.h b/include/xbt/misc.h index be067f9497..7a5ea898b7 100644 --- a/include/xbt/misc.h +++ b/include/xbt/misc.h @@ -81,7 +81,7 @@ * Function calling convention (not used for now) */ -#ifdef _WIN32 +#ifdef _XBT_WIN32 # ifndef _XBT_CALL # define _XBT_CALL __cdecl # endif @@ -146,7 +146,7 @@ # define XBT_PUBLIC_DATA(type) extern type /* Link against the DLL */ -#elif (defined(_WIN32) && !defined(DLL_EXPORT) && !defined(DLL_STATIC)) +#elif (defined(_XBT_WIN32) && !defined(DLL_EXPORT) && !defined(DLL_STATIC)) # define XBT_PUBLIC(type) __declspec(dllimport) type # define XBT_EXPORT_NO_IMPORT(type) type # define XBT_IMPORT_NO_EXPORT(type) __declspec(dllimport) type diff --git a/src/gras/Msg/gras_msg_listener.c b/src/gras/Msg/gras_msg_listener.c index 5d8ef35eb9..9805950ab0 100644 --- a/src/gras/Msg/gras_msg_listener.c +++ b/src/gras/Msg/gras_msg_listener.c @@ -57,7 +57,7 @@ static void listener_function(void *p) int sock; xbt_queue_shift_timed(me->socks_to_close, &sock, 0); if (tcp_close(sock) < 0) { -#ifdef _WIN32 +#ifdef _XBT_WIN32 WARN2("error while closing tcp socket %d: %d (%s)\n", sock, sock_errno); #else WARN3("error while closing tcp socket %d: %d (%s)\n", diff --git a/src/gras/Virtu/rl_process.c b/src/gras/Virtu/rl_process.c index e863eb3e7e..a2ba1a4ae5 100644 --- a/src/gras/Virtu/rl_process.c +++ b/src/gras/Virtu/rl_process.c @@ -23,7 +23,7 @@ XBT_EXPORT_NO_IMPORT(char const *) _gras_procname = NULL; # include # define environ (*_NSGetEnviron()) # else - #ifdef WIN32 + #ifdef _XBT_WIN32 /* the environment, as specified by the opengroup, used to initialize the process properties */ extern char **wenviron; #else @@ -74,7 +74,7 @@ const char *xbt_procname(void) int gras_os_getpid(void) { -#ifdef _WIN32 +#ifdef _XBT_WIN32 return (long int) GetCurrentProcessId(); #else return (long int) getpid(); diff --git a/src/portable.h b/src/portable.h index 7a71ee0129..76e6f7b9d4 100644 --- a/src/portable.h +++ b/src/portable.h @@ -13,9 +13,9 @@ #include "simgrid_config.h" #include "xbt/misc.h" /* - * win32 or win64 (__WIN32 is defined for win32 and win64 applications, __TOS_WIN__ is defined by xlC). + * win32 or win64 (__XBT_WIN32 is defined for win32 and win64 applications, __TOS_WIN__ is defined by xlC). */ -#ifdef _WIN32 +#ifdef _XBT_WIN32 # include "win32/config.h" # include #else diff --git a/src/simdag/dax_dtd.c b/src/simdag/dax_dtd.c index a5cc420faa..c7d5d926f9 100644 --- a/src/simdag/dax_dtd.c +++ b/src/simdag/dax_dtd.c @@ -1316,7 +1316,7 @@ const char rcs_dax__flexml[] = #include #include -#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) +#if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) # ifndef __STRICT_ANSI__ # include # include @@ -1568,7 +1568,7 @@ const char* *dax__statenames=NULL; * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ -#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) +#if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) # ifndef __STRICT_ANSI__ # include # include diff --git a/src/simdag/dax_dtd.l b/src/simdag/dax_dtd.l index 062341a7c0..0f79b9e8b4 100644 --- a/src/simdag/dax_dtd.l +++ b/src/simdag/dax_dtd.l @@ -61,7 +61,7 @@ const char rcs_dax__flexml[] = #include #include -#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) +#if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) # ifndef __STRICT_ANSI__ # include # include diff --git a/src/simix/smx_context.c b/src/simix/smx_context.c index 7bc68a7069..09c75b03bd 100644 --- a/src/simix/smx_context.c +++ b/src/simix/smx_context.c @@ -37,7 +37,7 @@ void SIMIX_context_mod_init(void) #ifdef CONTEXT_THREADS /* context switch based os thread */ SIMIX_ctx_thread_factory_init(&simix_global->context_factory); -#elif !defined(WIN32) +#elif !defined(_XBT_WIN32) /* context switch based ucontext */ SIMIX_ctx_sysv_factory_init(&simix_global->context_factory); #else @@ -124,7 +124,7 @@ void SIMIX_context_init_factory_by_name(smx_context_factory_t * factory, #endif /* CONTEXT_THREADS */ else if (!strcmp(name, "sysv")) - #if !defined(WIN32) && !defined(CONTEXT_THREADS) + #if !defined(_XBT_WIN32) && !defined(CONTEXT_THREADS) SIMIX_ctx_sysv_factory_init(factory); #else THROW0(not_found_error, 0, "Factory 'sysv' does not exist: no System V thread support under Windows"); diff --git a/src/simix/smx_context_sysv.c b/src/simix/smx_context_sysv.c index 775db1c1be..da3dd53eaa 100644 --- a/src/simix/smx_context_sysv.c +++ b/src/simix/smx_context_sysv.c @@ -14,7 +14,7 @@ # include #endif /* HAVE_VALGRIND_VALGRIND_H */ -#ifdef WIN32 +#ifdef _XBT_WIN32 #include "ucontext.h" #include "ucontext.c" #endif diff --git a/src/surf/random_mgr.c b/src/surf/random_mgr.c index f09822660f..ebc698d71d 100644 --- a/src/surf/random_mgr.c +++ b/src/surf/random_mgr.c @@ -7,7 +7,7 @@ #include "surf/random_mgr.h" #include "xbt/sysdep.h" -#ifdef WIN32 +#ifdef _XBT_WIN32 static unsigned int _seed = 2147483647; diff --git a/src/surf/simgrid_dtd.c b/src/surf/simgrid_dtd.c index c7d66fbca0..40d97fafb1 100644 --- a/src/surf/simgrid_dtd.c +++ b/src/surf/simgrid_dtd.c @@ -2878,7 +2878,7 @@ const char rcs_surfxml_flexml[] = #include #include -#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) +#if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) # ifndef __STRICT_ANSI__ # include # include @@ -3256,7 +3256,7 @@ const char* *surfxml_statenames=NULL; * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ -#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) +#if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) # ifndef __STRICT_ANSI__ # include # include diff --git a/src/surf/simgrid_dtd.l b/src/surf/simgrid_dtd.l index 806031fb04..1e20dc3b78 100644 --- a/src/surf/simgrid_dtd.l +++ b/src/surf/simgrid_dtd.l @@ -61,7 +61,7 @@ const char rcs_surfxml_flexml[] = #include #include -#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) +#if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) # ifndef __STRICT_ANSI__ # include # include diff --git a/src/surf/surf.c b/src/surf/surf.c index 427af07a47..0245079e01 100644 --- a/src/surf/surf.c +++ b/src/surf/surf.c @@ -19,7 +19,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_kernel, surf, #define MAX_DRIVE 26 #endif -#ifdef _WIN32 +#ifdef _XBT_WIN32 #include static const char *disk_drives_letter_table[MAX_DRIVE] = { "A:\\", @@ -49,7 +49,7 @@ static const char *disk_drives_letter_table[MAX_DRIVE] = { "Y:\\", "Z:\\" }; -#endif /* #ifdef _WIN32 */ +#endif /* #ifdef _XBT_WIN32 */ /* * Returns the initial path. On Windows the initial path is @@ -61,7 +61,7 @@ static const char *disk_drives_letter_table[MAX_DRIVE] = { const char *__surf_get_initial_path(void) { -#ifdef _WIN32 +#ifdef _XBT_WIN32 unsigned i; char current_directory[MAX_PATH + 1] = { 0 }; unsigned int len = GetCurrentDirectory(MAX_PATH + 1, current_directory); @@ -89,7 +89,7 @@ const char *__surf_get_initial_path(void) */ int __surf_is_absolute_file_path(const char *file_path) { -#ifdef _WIN32 +#ifdef _XBT_WIN32 WIN32_FIND_DATA wfd = { 0 }; HANDLE hFile = FindFirstFile(file_path, &wfd); @@ -285,7 +285,7 @@ void surf_init(int *argc, char **argv) #endif } -#ifdef WIN32 +#ifdef _XBT_WIN32 # define FILE_DELIM "\\" #else # define FILE_DELIM "/" /* FIXME: move to better location */ diff --git a/src/win32/platform/select_platform_features.h b/src/win32/platform/select_platform_features.h index 92830d739a..93f536616d 100644 --- a/src/win32/platform/select_platform_features.h +++ b/src/win32/platform/select_platform_features.h @@ -14,7 +14,7 @@ /* - * win32 or win64 (__WIN32 is defined for win32 and win64 applications, __TOS_WIN__ is defined by xlC). + * win32 or win64 (__XBT_WIN32 is defined for win32 and win64 applications, __TOS_WIN__ is defined by xlC). */ /* If the platform is not resolved _XBT_PLATFORM_ID is set to zero. */ @@ -69,8 +69,8 @@ #endif #if defined(_XBT_WIN32_PLATFORM) || defined(_XBT_WIN64_PLATFORM) || defined(_XBT_WIN16_PLATFORM) || defined(_XBT_WINCE_PLATFORM) -#ifndef _WIN32 - #define _WIN32 +#ifndef _XBT_WIN32 + #define _XBT_WIN32 #endif #endif @@ -102,4 +102,4 @@ -#endif /* #define __XBT_SELECT_PLATFORM_FEATURES_H__ */ \ No newline at end of file +#endif /* #define __XBT_SELECT_PLATFORM_FEATURES_H__ */ diff --git a/src/xbt/ex.c b/src/xbt/ex.c index 5eae5fc4f7..a3c5a8bd4a 100644 --- a/src/xbt/ex.c +++ b/src/xbt/ex.c @@ -58,7 +58,7 @@ # define HAVE_BACKTRACE 1 /* Hello linux box */ #endif -#if defined(WIN32) && defined(_M_IX86) && !defined(__GNUC__) +#if defined(_XBT_WIN32) && defined(_M_IX86) && !defined(__GNUC__) # define HAVE_BACKTRACE 1 /* Hello x86 windows box */ #endif @@ -122,7 +122,7 @@ void xbt_backtrace_display_current(void) #if defined(HAVE_EXECINFO_H) && defined(HAVE_POPEN) && defined(ADDR2LINE) # include "backtrace_linux.c" -#elif (defined(WIN32) && defined (_M_IX86)) && !defined(__GNUC__) +#elif (defined(_XBT_WIN32) && defined (_M_IX86)) && !defined(__GNUC__) # include "backtrace_windows.c" #else # include "backtrace_dummy.c" diff --git a/src/xbt/graphxml.c b/src/xbt/graphxml.c index 1da59763e5..a85b673bbc 100644 --- a/src/xbt/graphxml.c +++ b/src/xbt/graphxml.c @@ -1114,7 +1114,7 @@ const char rcs_graphxml_flexml[] = #include #include -#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) +#if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) # ifndef __STRICT_ANSI__ # include # include @@ -1332,7 +1332,7 @@ const char* *graphxml_statenames=NULL; * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ -#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) +#if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) # ifndef __STRICT_ANSI__ # include # include diff --git a/src/xbt/graphxml.l b/src/xbt/graphxml.l index d55652525d..5c3becc9a8 100644 --- a/src/xbt/graphxml.l +++ b/src/xbt/graphxml.l @@ -61,7 +61,7 @@ const char rcs_graphxml_flexml[] = #include #include -#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) +#if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__) # ifndef __STRICT_ANSI__ # include # include diff --git a/src/xbt/log.c b/src/xbt/log.c index 269c7c05e1..bcd94e9e0a 100644 --- a/src/xbt/log.c +++ b/src/xbt/log.c @@ -621,7 +621,7 @@ void _xbt_log_event_log(xbt_log_event_t ev, const char *fmt, ...) va_end(ev->ap); va_end(ev->ap_copy); -#ifdef WIN32 +#ifdef _XBT_WIN32 free(ev->buffer); #endif } diff --git a/src/xbt/setset.c b/src/xbt/setset.c index d5c33e92c9..34581828bb 100644 --- a/src/xbt/setset.c +++ b/src/xbt/setset.c @@ -5,7 +5,7 @@ #include "xbt/sysdep.h" /*The function ffs doesn't exist for windows*/ -#ifdef WIN32 +#ifdef _XBT_WIN32 int XBT_INLINE ffs(int x) { int r; diff --git a/src/xbt/xbt_main.c b/src/xbt/xbt_main.c index 47bef26598..8ce310ba9b 100644 --- a/src/xbt/xbt_main.c +++ b/src/xbt/xbt_main.c @@ -57,7 +57,7 @@ static void xbt_postexit(void) _XBT_GNUC_DESTRUCTOR; #pragma fini (xbt_postexit) #endif -#ifdef WIN32 +#ifdef _XBT_WIN32 #include /* Dummy prototype to make gcc happy */ diff --git a/src/xbt/xbt_os_thread.c b/src/xbt/xbt_os_thread.c index c2768de3e8..8b99b2770c 100644 --- a/src/xbt/xbt_os_thread.c +++ b/src/xbt/xbt_os_thread.c @@ -576,7 +576,7 @@ void xbt_os_sem_get_value(xbt_os_sem_t sem, int *svalue) /* ********************************* WINDOWS IMPLEMENTATION ************************************ */ -#elif defined(WIN32) +#elif defined(_XBT_WIN32) #include diff --git a/src/xbt/xbt_os_time.c b/src/xbt/xbt_os_time.c index 0345e0f5eb..19624a5905 100644 --- a/src/xbt/xbt_os_time.c +++ b/src/xbt/xbt_os_time.c @@ -13,7 +13,7 @@ #include /* floor */ -#ifdef WIN32 +#ifdef _XBT_WIN32 #include #endif @@ -22,7 +22,7 @@ double xbt_os_time(void) #ifdef HAVE_GETTIMEOFDAY struct timeval tv; gettimeofday(&tv, NULL); -#elif defined(WIN32) +#elif defined(_XBT_WIN32) struct timeval tv; # if defined(WIN32_WCE) || (_WIN32_WINNT < 0x0400) struct _timeb tm; @@ -59,7 +59,7 @@ void xbt_os_sleep(double sec) sleep(sec); (void) usleep((sec - floor(sec)) * 1000000); -#elif WIN32 +#elif _XBT_WIN32 Sleep((floor(sec) * 1000) + ((sec - floor(sec)) * 1000)); #else /* don't have usleep. Use select to sleep less than one second */ diff --git a/src/xbt/xbt_rl_synchro.c b/src/xbt/xbt_rl_synchro.c index 0bdbba6ea0..aee53fbdaa 100644 --- a/src/xbt/xbt_rl_synchro.c +++ b/src/xbt/xbt_rl_synchro.c @@ -93,7 +93,7 @@ struct xbt_mutex_ { /* KEEP IT IN SYNC WITH OS IMPLEMENTATION (both win and lin) */ #ifdef HAVE_PTHREAD_H pthread_mutex_t m; -#elif defined(WIN32) +#elif defined(_XBT_WIN32) CRITICAL_SECTION lock; #endif }; @@ -129,7 +129,7 @@ void xbt_mutex_destroy(xbt_mutex_t mutex) xbt_os_mutex_destroy((xbt_os_mutex_t) mutex); } -#ifdef WIN32 +#ifdef _XBT_WIN32 enum { /* KEEP IT IN SYNC WITH OS IMPLEM */ SIGNAL = 0, BROADCAST = 1, @@ -142,7 +142,7 @@ typedef struct xbt_cond_ { /* KEEP IT IN SYNC WITH OS IMPLEMENTATION (both win and lin) */ #ifdef HAVE_PTHREAD_H pthread_cond_t c; -#elif defined(WIN32) +#elif defined(_XBT_WIN32) HANDLE events[MAX_EVENTS]; unsigned int waiters_count; /* the number of waiters */ diff --git a/teshsuite/simdag/platforms/flatifier.c b/teshsuite/simdag/platforms/flatifier.c index 603a568b25..86f2941de2 100644 --- a/teshsuite/simdag/platforms/flatifier.c +++ b/teshsuite/simdag/platforms/flatifier.c @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#ifndef WIN32 +#ifndef _XBT_WIN32 #include #endif diff --git a/tools/gras/stub_generator.c b/tools/gras/stub_generator.c index 5dade2ab08..a94dec9f30 100644 --- a/tools/gras/stub_generator.c +++ b/tools/gras/stub_generator.c @@ -27,7 +27,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(stubgen, gras, "Stub generator"); -#ifdef _WIN32 +#ifdef _XBT_WIN32 #include #endif @@ -159,7 +159,7 @@ int main(int argc, char *argv[]) generate_sim(project_name); generate_rl(project_name); generate_makefile_local(project_name, deployment_file); -#ifdef _WIN32 +#ifdef _XBT_WIN32 generate_borland_simulation_project(project_name); generate_borland_real_life_project(project_name); generate_simulation_dsp_file(project_name); diff --git a/tools/gras/unix_stub_generator.c b/tools/gras/unix_stub_generator.c index b5bc335b2e..5e1733e377 100644 --- a/tools/gras/unix_stub_generator.c +++ b/tools/gras/unix_stub_generator.c @@ -25,7 +25,7 @@ #include -#ifdef _WIN32 +#ifdef _XBT_WIN32 /* stupid stubs so that it compiles on windows */ void generate_sim(char *project) { diff --git a/tools/gras/windows_stub_generator.c b/tools/gras/windows_stub_generator.c index 889a240f18..d2c46f13b3 100644 --- a/tools/gras/windows_stub_generator.c +++ b/tools/gras/windows_stub_generator.c @@ -29,7 +29,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(stubgen); -#ifdef _WIN32 +#ifdef _XBT_WIN32 char *__gras_path = NULL; @@ -568,7 +568,7 @@ void borland_project_create_main_file(const char *name) FILE *stream = fopen(name, "w+"); fprintf(stream, - "Ce fichier est uniquement utilisé par le gestionnaire de projets et doit être traité comme le fichier projet\n\n\nmain\n"); + "Ce fichier est uniquement utilis� par le gestionnaire de projets et doit �tre trait� comme le fichier projet\n\n\nmain\n"); fclose(stream); } @@ -966,12 +966,12 @@ void generate_dsp_project(dsp_t project, int is_rl, const char *name) fprintf(project->stream, "# PROP Intermediate_Dir \"Release\"\n"); fprintf(project->stream, "# PROP Target_Dir \"\"\n"); /* TODO : the include directory */ - /*fprintf(project->stream,"# ADD BASE CPP /nologo /W3 /GX /O2 /I \"./%s\" /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /c\n",__gras_path); */ + /*fprintf(project->stream,"# ADD BASE CPP /nologo /W3 /GX /O2 /I \"./%s\" /D \"_XBT_WIN32\" /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /c\n",__gras_path); */ fprintf(project->stream, - "# ADD BASE CPP /nologo /W3 /GX /O2 /I \"%s\" /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /c\n", + "# ADD BASE CPP /nologo /W3 /GX /O2 /I \"%s\" /D \"_XBT_WIN32\" /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /c\n", __gras_path); fprintf(project->stream, - "# ADD CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /c\n"); + "# ADD CPP /nologo /W3 /GX /O2 /D \"_XBT_WIN32\" /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /c\n"); fprintf(project->stream, "# ADD BASE RSC /l 0x40c /d \"NDEBUG\"\n"); fprintf(project->stream, "# ADD RSC /l 0x40c /d \"NDEBUG\n"); fprintf(project->stream, "BSC32=bscmake.exe\n"); @@ -1003,12 +1003,12 @@ void generate_dsp_project(dsp_t project, int is_rl, const char *name) fprintf(project->stream, "# PROP Ignore_Export_Lib 0\n"); fprintf(project->stream, "# PROP Target_Dir \"\"\n"); /* TODO : the include directory */ - /*fprintf(project->stream,"# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I \"./%s\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /GZ /c\n",__gras_path); */ + /*fprintf(project->stream,"# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I \"./%s\" /D \"_XBT_WIN32\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /GZ /c\n",__gras_path); */ fprintf(project->stream, - "# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I \"%s\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /GZ /c\n", + "# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I \"%s\" /D \"_XBT_WIN32\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /GZ /c\n", __gras_path); fprintf(project->stream, - "# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /GZ /c\n"); + "# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D \"_XBT_WIN32\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /GZ /c\n"); fprintf(project->stream, "# ADD BASE RSC /l 0x40c /d \"_DEBUG\"\n"); fprintf(project->stream, "# ADD RSC /l 0x40c /d \"_DEBUG\"\n"); fprintf(project->stream, "BSC32=bscmake.exe\n"); diff --git a/tools/tesh2/include/def.h b/tools/tesh2/include/def.h index ea3bd267cb..362448cb59 100644 --- a/tools/tesh2/include/def.h +++ b/tools/tesh2/include/def.h @@ -2,7 +2,7 @@ #define __DEF_H #if (defined(__BUILTIN) && !defined(__CHKCMD) && !defined(WARN_DEF_MISMATCH)) -#ifdef WIN32 +#ifdef _XBT_WIN32 #pragma message(Macro definition mismatch : __BUILTIN defined but __CHKCMD not defined) #else #warning "Macro definition mismatch : __BUILTIN defined but __CHKCMD not defined" @@ -11,7 +11,7 @@ #endif /* must be defined first */ -#ifdef WIN32 +#ifdef _XBT_WIN32 #define _WIN32_WINNT 0x0400 @@ -29,7 +29,7 @@ extern "C" { #endif -#ifdef WIN32 +#ifdef _XBT_WIN32 #define strdup _strdup #define chdir _chdir diff --git a/tools/tesh2/include/types.h b/tools/tesh2/include/types.h index 50d2deeea8..322d81c229 100644 --- a/tools/tesh2/include/types.h +++ b/tools/tesh2/include/types.h @@ -39,7 +39,7 @@ extern "C" { * file descriptor and pid types for portability. */ -#ifdef WIN32 +#ifdef _XBT_WIN32 #ifndef __FD_T_DEFINED typedef HANDLE fd_t; @@ -316,7 +316,7 @@ typedef struct s_context output_handling_t output_handling; int async; /* if 1, the command is asynchronous */ - #ifdef WIN32 + #ifdef _XBT_WIN32 char* t_command_line; /* translate the command line on Windows */ unsigned is_not_found:1; #endif @@ -345,7 +345,7 @@ typedef struct s_command fd_t stdout_fd; /* the stdout fd of the command */ fd_t stdin_fd; /* the stdin fd of the command */ int exit_code; /* the exit code of the command */ - #ifdef WIN32 + #ifdef _XBT_WIN32 unsigned long stat_val; #else int stat_val; @@ -353,7 +353,7 @@ typedef struct s_command char* signal; /* the signal raised by the command if any */ xbt_os_mutex_t mutex; - #ifndef WIN32 + #ifndef _XBT_WIN32 int killed; /* if 1, the command was killed */ int execlp_errno; #endif diff --git a/tools/tesh2/include/xsignal.h b/tools/tesh2/include/xsignal.h index b4be02ad7b..d4d42da072 100644 --- a/tools/tesh2/include/xsignal.h +++ b/tools/tesh2/include/xsignal.h @@ -8,7 +8,7 @@ extern "C" { #endif -#ifdef WIN32 +#ifdef _XBT_WIN32 /* terminal line hangup */ #ifndef SIGHUP @@ -179,10 +179,10 @@ is_an_unhandled_exception(DWORD exit_code); */ #define WTERMSIG(__status) (__status) -#endif /* WIN32 */ +#endif /* _XBT_WIN32 */ -#ifdef WIN32 +#ifdef _XBT_WIN32 const char* signal_name(DWORD got, const char* expected); #else diff --git a/tools/tesh2/src/command.c b/tools/tesh2/src/command.c index 3f911f6aea..677979f7d9 100644 --- a/tools/tesh2/src/command.c +++ b/tools/tesh2/src/command.c @@ -18,7 +18,7 @@ #include #include -#ifndef WIN32 +#ifndef _XBT_WIN32 #include #include #include @@ -150,7 +150,7 @@ command_new(unit_t unit, context_t context, xbt_os_mutex_t mutex) command->root->cmd_nb++; xbt_os_mutex_release(mutex); - #ifndef WIN32 + #ifndef _XBT_WIN32 command->killed = 0; command->execlp_errno = 0; #endif @@ -209,7 +209,7 @@ command_start(void* p) /* execute the command of the test */ - #ifndef WIN32 + #ifndef _XBT_WIN32 command_exec(command, command->context->command_line); #else /* play the translated command line on Windows */ @@ -257,7 +257,7 @@ command_start(void* p) return NULL; } -#ifdef WIN32 +#ifdef _XBT_WIN32 #ifndef BUFSIZE #define BUFSIZE 4096 @@ -666,7 +666,7 @@ command_exec(command_t command, const char* command_line) } #endif -#ifdef WIN32 +#ifdef _XBT_WIN32 void command_wait(command_t command) { @@ -809,7 +809,7 @@ command_check(command_t command) while(!command->reader->done) xbt_os_thread_yield(); - #ifdef WIN32 + #ifdef _XBT_WIN32 CloseHandle(command->stdout_fd); #else close(command->stdout_fd); @@ -889,7 +889,7 @@ command_check(command_t command) } } -#ifdef WIN32 +#ifdef _XBT_WIN32 void command_kill(command_t command) { @@ -954,7 +954,7 @@ command_summarize(command_t command) if(cs_successeded != command->status) { - #ifndef WIN32 + #ifndef _XBT_WIN32 if(command->killed) printf(" \n"); #endif @@ -1177,7 +1177,7 @@ command_free(command_t* ptr) { /* close the stdin and the stdout pipe handles */ - #ifdef WIN32 + #ifdef _XBT_WIN32 if((*ptr)->stdin_fd != INDEFINITE_FD) CloseHandle((*ptr)->stdin_fd); diff --git a/tools/tesh2/src/context.c b/tools/tesh2/src/context.c index 3ddd1b210e..918e8102af 100644 --- a/tools/tesh2/src/context.c +++ b/tools/tesh2/src/context.c @@ -35,7 +35,7 @@ context_new(void) context->output_handling = oh_check; context->async = 0; - #ifdef WIN32 + #ifdef _XBT_WIN32 context->t_command_line = NULL; context->is_not_found = 0; #endif @@ -61,7 +61,7 @@ context_free(context_t* ptr) if((*ptr)->signal) free((*ptr)->signal); - #ifdef WIN32 + #ifdef _XBT_WIN32 if((*ptr)->t_command_line) free((*ptr)->t_command_line); #endif @@ -83,7 +83,7 @@ context_reset(context_t context) context->command_line = NULL; } - #ifdef WIN32 + #ifdef _XBT_WIN32 if(context->t_command_line) { free(context->t_command_line); @@ -134,7 +134,7 @@ context_dup(context_t context) dup->command_line = strdup(context->command_line); - #ifdef WIN32 + #ifdef _XBT_WIN32 dup->t_command_line = strdup(context->t_command_line); dup->is_not_found = context->is_not_found; #endif @@ -186,7 +186,7 @@ context_clear(context_t context) context->command_line = NULL; } - #ifdef WIN32 + #ifdef _XBT_WIN32 if(context->t_command_line) { free(context->t_command_line); diff --git a/tools/tesh2/src/fstream.c b/tools/tesh2/src/fstream.c index 313717fd99..f0e39111fd 100644 --- a/tools/tesh2/src/fstream.c +++ b/tools/tesh2/src/fstream.c @@ -25,11 +25,11 @@ #include #include -#ifndef WIN32 +#ifndef _XBT_WIN32 #include #endif -#ifdef WIN32 +#ifdef _XBT_WIN32 static int is_w32_cmd(char* cmd, char** path) { @@ -181,7 +181,7 @@ fstream_open(fstream_t fstream) return 0; } - #ifndef WIN32 + #ifndef _XBT_WIN32 sprintf(path,"%s/%s",fstream->directory, fstream->name); #else sprintf(path,"%s\\%s",fstream->directory, fstream->name); @@ -329,14 +329,14 @@ fstream_parse(fstream_t fstream, xbt_os_mutex_t mutex) if(context->command_line) { - #ifdef WIN32 + #ifdef _XBT_WIN32 if(!context->is_not_found) { #endif if(fstream_launch_command(fstream, context, mutex) < 0) break; - #ifdef WIN32 + #ifdef _XBT_WIN32 } #endif } @@ -384,7 +384,7 @@ fstream_parse(fstream_t fstream, xbt_os_mutex_t mutex) /* Check that last command of the file ran well */ if(context->command_line) { - #ifdef WIN32 + #ifdef _XBT_WIN32 if(!context->is_not_found) { #endif @@ -392,7 +392,7 @@ fstream_parse(fstream_t fstream, xbt_os_mutex_t mutex) if(fstream_launch_command(fstream, context, mutex) < 0) return -1; - #ifdef WIN32 + #ifdef _XBT_WIN32 } #endif } @@ -1282,7 +1282,7 @@ fstream_process_token(fstream_t fstream, context_t context, xbt_os_mutex_t mutex context->line = /*strdup(filepos)*/ filepos; context->pos = strdup(filepos); - #ifdef WIN32 + #ifdef _XBT_WIN32 { /* translate the command line */ @@ -1484,7 +1484,7 @@ fstream_process_token(fstream_t fstream, context_t context, xbt_os_mutex_t mutex xbt_str_trim(context->signal," \n"); - #ifdef WIN32 + #ifdef _XBT_WIN32 if(!strstr("SIGSEGVSIGTRAPSIGBUSSIGFPESIGILL", context->signal)) { ERROR2("[%s] Signal `%s' not supported by this platform", filepos, context->signal); @@ -1685,7 +1685,7 @@ fstream_process_token(fstream_t fstream, context_t context, xbt_os_mutex_t mutex { if(exists) { - #ifndef WIN32 + #ifndef _XBT_WIN32 unsetenv(name); #else SetEnvironmentVariable(name, NULL); @@ -1816,7 +1816,7 @@ fstream_process_token(fstream_t fstream, context_t context, xbt_os_mutex_t mutex free(variable->val); variable->val = strdup(val); - #ifdef WIN32 + #ifdef _XBT_WIN32 SetEnvironmentVariable(variable->name, variable->val); #else setenv(variable->name, variable->val, 1); @@ -1853,7 +1853,7 @@ fstream_process_token(fstream_t fstream, context_t context, xbt_os_mutex_t mutex xbt_dynar_push(unit->runner->variables, &variable); - #ifdef WIN32 + #ifdef _XBT_WIN32 SetEnvironmentVariable(variable->name, variable->val); #else setenv(variable->name, variable->val, 0); diff --git a/tools/tesh2/src/getpath.c b/tools/tesh2/src/getpath.c index ffd9e8cdcf..4f768d7482 100644 --- a/tools/tesh2/src/getpath.c +++ b/tools/tesh2/src/getpath.c @@ -10,7 +10,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(tesh); #include #include -#ifndef WIN32 +#ifndef _XBT_WIN32 #include #else #endif @@ -22,7 +22,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(tesh); #define PATH_MAX 255 #endif -#ifndef WIN32 +#ifndef _XBT_WIN32 int getpath(const char* file, char** path) { diff --git a/tools/tesh2/src/main.c b/tools/tesh2/src/main.c index 3a8e7b9e2f..c169f1ef51 100644 --- a/tools/tesh2/src/main.c +++ b/tools/tesh2/src/main.c @@ -45,7 +45,7 @@ typedef struct s_optentry /* logs */ XBT_LOG_NEW_DEFAULT_CATEGORY(tesh,"TEst SHell utility"); -#ifdef WIN32 +#ifdef _XBT_WIN32 /* Windows specific : the previous process error mode */ static UINT prev_error_mode = 0; @@ -301,7 +301,7 @@ finalized = 0; static int sig_int = 0; -#ifdef WIN32 +#ifdef _XBT_WIN32 static void sig_int_handler(int signum) { @@ -428,7 +428,7 @@ main(int argc, char* argv[]) /* then, finalize tesh (release all the allocated memory and exits) */ finalize(); - #ifndef WIN32 + #ifndef _XBT_WIN32 return exit_code; #endif @@ -449,7 +449,7 @@ init(void) char* buffer; char* suffix = strdup(".tesh"); - #ifdef WIN32 + #ifdef _XBT_WIN32 /* Windows specific : don't display the general-protection-fault message box and * the the critical-error-handler message box (instead the system send the error * to the calling process : tesh) @@ -607,7 +607,7 @@ finalize(void) xbt_os_sem_destroy(units_sem); /* Windows specific (restore the previouse error mode */ - #ifdef WIN32 + #ifdef _XBT_WIN32 SetErrorMode(prev_error_mode); #endif @@ -761,7 +761,7 @@ process_command_line(int argc, char** argv) /* get to the last / (if any) to get the short name of the file */ delimiter = strrchr(optarg,'/'); - #ifdef WIN32 + #ifdef _XBT_WIN32 if(!delimiter) delimiter = strrchr(optarg,'\\'); #endif @@ -979,7 +979,7 @@ process_command_line(int argc, char** argv) delimiter = strrchr(optarg,'/'); - #ifdef WIN32 + #ifdef _XBT_WIN32 if(!delimiter) delimiter = strrchr(optarg,'\\'); #endif @@ -1064,7 +1064,7 @@ process_command_line(int argc, char** argv) delimiter = strrchr(optarg,'/'); - #ifdef WIN32 + #ifdef _XBT_WIN32 if(!delimiter) delimiter = strrchr(optarg,'\\'); #endif @@ -1149,7 +1149,7 @@ print_usage(void) if(!screen_cleaned) { - #ifdef WIN32 + #ifdef _XBT_WIN32 system("cls"); #else system("clear"); @@ -1170,7 +1170,7 @@ print_version(void) { if(!screen_cleaned) { - #ifdef WIN32 + #ifdef _XBT_WIN32 system("cls"); #else system("clear"); diff --git a/tools/tesh2/src/reader.c b/tools/tesh2/src/reader.c index ddff42174f..6aa254ae7e 100644 --- a/tools/tesh2/src/reader.c +++ b/tools/tesh2/src/reader.c @@ -62,7 +62,7 @@ reader_read(reader_t reader) reader->thread = xbt_os_thread_create("", reader_start_routine, reader); } -#ifdef WIN32 +#ifdef _XBT_WIN32 static void* reader_start_routine(void* p) { diff --git a/tools/tesh2/src/runner.c b/tools/tesh2/src/runner.c index 79ccc0875f..35f06916b3 100644 --- a/tools/tesh2/src/runner.c +++ b/tools/tesh2/src/runner.c @@ -24,7 +24,7 @@ #include #include -#ifndef WIN32 +#ifndef _XBT_WIN32 #include #endif @@ -36,7 +36,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(tesh); -#if (!defined(__BUILTIN) && defined(__CHKCMD) && !defined(WIN32)) +#if (!defined(__BUILTIN) && defined(__CHKCMD) && !defined(_XBT_WIN32)) static const char* builtin[] = { "alias", @@ -92,12 +92,16 @@ static const char* builtin[] = /* under darwin, the environment gets added to the process at startup time. So, it's not defined at library link time, forcing us to extra tricks */ # include # define environ (*_NSGetEnviron()) -# elif !defined(WIN32) - /* the environment, as specified by the opengroup, used to initialize the process properties */ - extern char **environ; +# else + #ifdef _XBT_WIN32 + /* the environment, as specified by the opengroup, used to initialize the process properties */ + # define environ **wenviron; + #else + extern char **environ; + #endif # endif -#ifndef WIN32 +#ifndef _XBT_WIN32 extern char** environ; #endif @@ -121,7 +125,7 @@ runner_start_routine(void* p); /*static void check_syntax(void);*/ -#ifdef WIN32 +#ifdef _XBT_WIN32 static HANDLE timer_handle = NULL; @@ -206,7 +210,7 @@ runner_init(/*int check_syntax_flag, */int timeout, fstreams_t fstreams) const char* cstr; variable_t variable; - #if (defined(__CHKCMD) && defined(__BUILTIN) && !defined(WIN32)) + #if (defined(__CHKCMD) && defined(__BUILTIN) && !defined(_XBT_WIN32)) FILE* s; int n = 0; size_t len; @@ -277,7 +281,7 @@ runner_init(/*int check_syntax_flag, */int timeout, fstreams_t fstreams) variable->env = 1; xbt_dynar_push(runner->variables, &variable); - #ifndef WIN32 + #ifndef _XBT_WIN32 if(!strcmp("PATH", buffer)) #else if(!strcmp("Path", buffer) || !strcmp("PATH", buffer)) @@ -288,7 +292,7 @@ runner_init(/*int check_syntax_flag, */int timeout, fstreams_t fstreams) /* get the list of paths */ - #ifdef WIN32 + #ifdef _XBT_WIN32 runner->path = explode(';', val); #else runner->path = explode(':', val); @@ -301,7 +305,7 @@ runner_init(/*int check_syntax_flag, */int timeout, fstreams_t fstreams) len = strlen(p); - #ifndef WIN32 + #ifndef _XBT_WIN32 for(j = len - 1; p[j] == '/' || p[j] == ' '; j--) #else for(j = len - 1; p[j] == '\\' || p[j] == ' '; j--) @@ -321,7 +325,7 @@ runner_init(/*int check_syntax_flag, */int timeout, fstreams_t fstreams) sprintf(buffer,"%d",getpid()); - #ifndef WIN32 + #ifndef _XBT_WIN32 setenv("TESH_PPID", buffer, 0); setenv("TESH_DIR", tesh_dir, 0); #else @@ -378,7 +382,7 @@ runner_init(/*int check_syntax_flag, */int timeout, fstreams_t fstreams) check_syntax(); */ - #if (!defined(WIN32) && defined(__CHKCMD)) + #if (!defined(_XBT_WIN32) && defined(__CHKCMD)) #if defined(__BUILTIN) if(!is_tesh_root) @@ -506,7 +510,7 @@ runner_destroy(void) if(runner->variables) xbt_dynar_free(&runner->variables); - #ifdef WIN32 + #ifdef _XBT_WIN32 CloseHandle(timer_handle); #endif @@ -600,7 +604,7 @@ runner_summarize(void) if(!dry_run_flag) { - #ifndef WIN32 + #ifndef _XBT_WIN32 struct rusage r_usage; #else FILETIME start_time; @@ -654,7 +658,7 @@ runner_summarize(void) printf(")\n\n"); - #ifndef WIN32 + #ifndef _XBT_WIN32 if(!getrusage(RUSAGE_SELF, &r_usage)) { diff --git a/tools/tesh2/src/writer.c b/tools/tesh2/src/writer.c index 3755abc822..f1f13c5d48 100644 --- a/tools/tesh2/src/writer.c +++ b/tools/tesh2/src/writer.c @@ -62,7 +62,7 @@ writer_write(writer_t writer) writer->thread = xbt_os_thread_create("", writer_start_routine, writer); } -#ifdef WIN32 +#ifdef _XBT_WIN32 static void* writer_start_routine(void* p) { diff --git a/tools/tesh2/src/xerrno.c b/tools/tesh2/src/xerrno.c index 3db98e178f..0b8deff47c 100644 --- a/tools/tesh2/src/xerrno.c +++ b/tools/tesh2/src/xerrno.c @@ -351,7 +351,7 @@ entry_t err[] = #include -#ifdef WIN32 +#ifdef _XBT_WIN32 static char * w32error_to_string(DWORD errcode) { @@ -391,7 +391,7 @@ error_to_string(int errcode, int kind) if(err[i].code == errcode && err[i].kind == kind) return err[i].string; - #ifdef WIN32 + #ifdef _XBT_WIN32 /* assume it's a W32 error */ return w32error_to_string((DWORD)errcode); diff --git a/tools/tesh2/src/xsignal.c b/tools/tesh2/src/xsignal.c index 9e5a914b69..3b0755cff6 100644 --- a/tools/tesh2/src/xsignal.c +++ b/tools/tesh2/src/xsignal.c @@ -10,7 +10,7 @@ #include -#ifdef WIN32 +#ifdef _XBT_WIN32 int is_an_unhandled_exception(DWORD exit_code); @@ -85,7 +85,7 @@ static const s_signal_entry_t signals[] = { {"SIG UNKNOWN" ,-1} }; -#ifdef WIN32 +#ifdef _XBT_WIN32 const char* signal_name(DWORD got, const char* expected) #else const char* signal_name(unsigned int got, char *expected) @@ -93,7 +93,7 @@ const char* signal_name(unsigned int got, char *expected) { int i; - #ifdef WIN32 + #ifdef _XBT_WIN32 for (i=0; i < MAX_EXECPTION; i++) if (exceptions[i].value == got) @@ -124,7 +124,7 @@ sig_exists(const char* sig_name) } -#ifdef WIN32 +#ifdef _XBT_WIN32 int is_an_unhandled_exception(DWORD exit_code) {