# include <windows.h>
#endif
-#if defined(UNIX_LIKE) || defined(CYGWIN32) || defined(SYMBIAN)
+#if defined(UNIX_LIKE) || defined(CYGWIN32) || defined(SYMBIAN) \
+ || (defined(CONSOLE_LOG) && defined(MSWIN32))
# include <fcntl.h>
# include <sys/types.h>
# include <sys/stat.h>
return GC_is_initialized;
}
-#if (defined(MSWIN32) || defined(MSWINCE)) && defined(THREADS)
+#if defined(GC_WIN32_THREADS) \
+ && ((defined(MSWIN32) && !defined(CONSOLE_LOG)) || defined(MSWINCE))
GC_INNER CRITICAL_SECTION GC_write_cs;
#endif
#if !defined(OS2) && !defined(MACOS) && !defined(GC_ANDROID_LOG) \
&& !defined(NN_PLATFORM_CTR) && !defined(NINTENDO_SWITCH) \
- && !defined(MSWIN32) && !defined(MSWINCE)
+ && (!defined(MSWIN32) || defined(CONSOLE_LOG)) && !defined(MSWINCE)
STATIC int GC_stdout = GC_DEFAULT_STDOUT_FD;
STATIC int GC_stderr = GC_DEFAULT_STDERR_FD;
STATIC int GC_log = GC_DEFAULT_STDERR_FD;
- GC_API void GC_CALL GC_set_log_fd(int fd)
- {
- GC_log = fd;
- }
+# ifndef MSWIN32
+ GC_API void GC_CALL GC_set_log_fd(int fd)
+ {
+ GC_log = fd;
+ }
+# endif
#endif
#ifdef MSGBOX_ON_ERROR
/* else */ InitializeCriticalSection(&GC_allocate_ml);
}
# endif
-# endif /* GC_WIN32_THREADS */
-# if (defined(MSWIN32) || defined(MSWINCE)) && defined(THREADS)
+# endif /* GC_WIN32_THREADS && !GC_PTHREADS */
+# if defined(GC_WIN32_THREADS) \
+ && ((defined(MSWIN32) && !defined(CONSOLE_LOG)) || defined(MSWINCE))
InitializeCriticalSection(&GC_write_cs);
# endif
GC_setpagesize();
# endif
# endif
# if ((defined(UNIX_LIKE) && !defined(GC_ANDROID_LOG)) \
+ || (defined(CONSOLE_LOG) && defined(MSWIN32)) \
|| defined(CYGWIN32) || defined(SYMBIAN)) && !defined(SMALL_CONFIG)
{
char * file_name = TRUSTED_STRING(GETENV("GC_LOG_FILE"));
if (GC_is_initialized) {
/* Prevent duplicate resource close. */
GC_is_initialized = FALSE;
-# if defined(THREADS) && (defined(MSWIN32) || defined(MSWINCE))
- DeleteCriticalSection(&GC_write_cs);
+# if defined(GC_WIN32_THREADS) && (defined(MSWIN32) || defined(MSWINCE))
+# if !defined(CONSOLE_LOG) || defined(MSWINCE)
+ DeleteCriticalSection(&GC_write_cs);
+# endif
DeleteCriticalSection(&GC_allocate_ml);
# endif
}
}
-#if defined(MSWIN32) || defined(MSWINCE)
+#if (defined(MSWIN32) && !defined(CONSOLE_LOG)) || defined(MSWINCE)
# if defined(_MSC_VER) && defined(_DEBUG) && !defined(MSWINCE)
# include <crtdbg.h>
# define WRITE(level, buf, unused_len) \
__android_log_write(level, GC_ANDROID_LOG_TAG, buf)
-# elif defined(NN_PLATFORM_CTR)
- int n3ds_log_write(const char* text, int length);
-# define WRITE(level, buf, len) n3ds_log_write(buf, len)
-# elif defined(NINTENDO_SWITCH)
- int switch_log_write(const char* text, int length);
-# define WRITE(level, buf, len) switch_log_write(buf, len)
+#elif defined(NN_PLATFORM_CTR)
+ int n3ds_log_write(const char* text, int length);
+# define WRITE(level, buf, len) n3ds_log_write(buf, len)
+
+#elif defined(NINTENDO_SWITCH)
+ int switch_log_write(const char* text, int length);
+# define WRITE(level, buf, len) switch_log_write(buf, len)
#else
-# if !defined(AMIGA) && !defined(MSWIN_XBOX1) && !defined(SN_TARGET_ORBIS) \
- && !defined(SN_TARGET_PSP2) && !defined(__CC_ARM)
+# if !defined(AMIGA) && !defined(MSWIN32) && !defined(MSWIN_XBOX1) \
+ && !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2) \
+ && !defined(__CC_ARM)
# include <unistd.h>
# endif
}
# define WRITE(f, buf, len) GC_write(f, buf, len)
-#endif /* !MSWIN32 && !OS2 && !MACOS && !GC_ANDROID_LOG */
+#endif /* !MSWINCE && !OS2 && !MACOS && !GC_ANDROID_LOG */
#define BUFSZ 1024
/* Avoid calling GC_err_printf() here, as GC_on_abort() could be */
/* called from it. Note 1: this is not an atomic output. */
/* Note 2: possible write errors are ignored. */
-# if defined(THREADS) && defined(GC_ASSERTIONS) \
- && (defined(MSWIN32) || defined(MSWINCE))
+# if defined(GC_WIN32_THREADS) && defined(GC_ASSERTIONS) \
+ && ((defined(MSWIN32) && !defined(CONSOLE_LOG)) || defined(MSWINCE))
if (!GC_write_disabled)
# endif
{
GC_on_thread_event(GC_EVENT_THREAD_SUSPENDED, THREAD_HANDLE(t));
}
-#if defined(GC_ASSERTIONS) && (defined(MSWIN32) || defined(MSWINCE))
+#if defined(GC_ASSERTIONS) \
+ && ((defined(MSWIN32) && !defined(CONSOLE_LOG)) || defined(MSWINCE))
GC_INNER GC_bool GC_write_disabled = FALSE;
/* TRUE only if GC_stop_world() acquired GC_write_cs. */
#endif
# if !defined(GC_NO_THREADS_DISCOVERY) || defined(GC_ASSERTIONS)
GC_please_stop = TRUE;
# endif
-# if defined(MSWIN32) || defined(MSWINCE)
+# if (defined(MSWIN32) && !defined(CONSOLE_LOG)) || defined(MSWINCE)
GC_ASSERT(!GC_write_disabled);
EnterCriticalSection(&GC_write_cs);
/* It's not allowed to call GC_printf() (and friends) here down to */
}
}
}
-# if defined(MSWIN32) || defined(MSWINCE)
+# if (defined(MSWIN32) && !defined(CONSOLE_LOG)) || defined(MSWINCE)
# ifdef GC_ASSERTIONS
GC_write_disabled = FALSE;
# endif