summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorSteven Noonan <steven@uplinklabs.net>2009-10-10 04:36:42 -0700
committerSteven Noonan <steven@uplinklabs.net>2009-10-10 22:18:48 -0700
commit66c59ae9c97694a8ab33eddd266dd6f73d72fde7 (patch)
treebd27426778e720fa895635b26b6a0909300d21af /crawl-ref
parent6eb4f8d4954d7ba008de2eb921d42e02993b9db5 (diff)
downloadcrawl-ref-66c59ae9c97694a8ab33eddd266dd6f73d72fde7.tar.gz
crawl-ref-66c59ae9c97694a8ab33eddd266dd6f73d72fde7.zip
project-wide: implement use of platform.h detection macros
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/AppHdr.h59
-rw-r--r--crawl-ref/source/Crawl.xcodeproj/project.pbxproj7
-rw-r--r--crawl-ref/source/abl-show.cc2
-rw-r--r--crawl-ref/source/acr.cc2
-rw-r--r--crawl-ref/source/beam.cc2
-rw-r--r--crawl-ref/source/chardump.cc2
-rw-r--r--crawl-ref/source/cio.cc4
-rw-r--r--crawl-ref/source/command.cc4
-rw-r--r--crawl-ref/source/crash-u.cc30
-rw-r--r--crawl-ref/source/debug.cc4
-rw-r--r--crawl-ref/source/defines.h2
-rw-r--r--crawl-ref/source/describe.cc2
-rw-r--r--crawl-ref/source/directn.cc2
-rw-r--r--crawl-ref/source/fight.cc2
-rw-r--r--crawl-ref/source/files.cc16
-rw-r--r--crawl-ref/source/food.cc2
-rw-r--r--crawl-ref/source/initfile.cc10
-rw-r--r--crawl-ref/source/invent.cc2
-rw-r--r--crawl-ref/source/itemname.cc2
-rw-r--r--crawl-ref/source/itemprop.cc2
-rw-r--r--crawl-ref/source/items.cc2
-rw-r--r--crawl-ref/source/libdos.cc4
-rw-r--r--crawl-ref/source/libutil.cc2
-rw-r--r--crawl-ref/source/libw32c.cc6
-rw-r--r--crawl-ref/source/menu.cc2
-rw-r--r--crawl-ref/source/message.cc2
-rw-r--r--crawl-ref/source/misc.cc4
-rw-r--r--crawl-ref/source/monspeak.cc2
-rw-r--r--crawl-ref/source/monstuff.cc2
-rw-r--r--crawl-ref/source/mutation.cc2
-rw-r--r--crawl-ref/source/newgame.cc4
-rw-r--r--crawl-ref/source/ouch.cc4
-rw-r--r--crawl-ref/source/output.cc2
-rw-r--r--crawl-ref/source/player.cc2
-rw-r--r--crawl-ref/source/religion.cc2
-rw-r--r--crawl-ref/source/shopping.cc2
-rw-r--r--crawl-ref/source/skills2.cc2
-rw-r--r--crawl-ref/source/spl-book.cc2
-rw-r--r--crawl-ref/source/spl-cast.cc2
-rw-r--r--crawl-ref/source/spl-util.cc2
-rw-r--r--crawl-ref/source/stuff.cc6
-rw-r--r--crawl-ref/source/tilesdl.h2
-rw-r--r--crawl-ref/source/travel.cc2
-rw-r--r--crawl-ref/source/view.cc8
-rw-r--r--crawl-ref/source/view.h2
45 files changed, 120 insertions, 110 deletions
diff --git a/crawl-ref/source/AppHdr.h b/crawl-ref/source/AppHdr.h
index 1478be5f23..6a7a4adf48 100644
--- a/crawl-ref/source/AppHdr.h
+++ b/crawl-ref/source/AppHdr.h
@@ -19,19 +19,7 @@
#ifndef APPHDR_H
#define APPHDR_H
-// Very simple OS detection, done via predefined macros
-// For a list of predefined macros, see
-// http://predef.sourceforge.net/
-#if defined(__MACH__)
- #ifndef OSX
- #define OSX
- #endif
-#endif
-#if defined(__FreeBSD__)
- #ifndef FREEBSD
- #define FREEBSD
- #endif
-#endif
+#include "platform.h"
// The maximum memory that the user-script Lua interpreter can
// allocate, in kilobytes. This limit is enforced to prevent
@@ -59,24 +47,43 @@
//
// #define DISABLE_STICKY_STARTUP_OPTIONS
-// OS X's Terminal.app has color handling problems; dark grey is
-// especially bad, so we'll want to remap that. OS X is otherwise
-// Unix-ish, so we shouldn't need other special handling.
-#if defined(OSX)
+//
+// Define 'UNIX' if the target OS is UNIX-like.
+//
+#if defined(TARGET_OS_MACOSX) || defined(TARGET_OS_LINUX) || \
+ defined(TARGET_OS_FREEBSD) || defined(TARGET_OS_NETBSD) || \
+ defined(TARGET_OS_OPENBSD) || defined(TARGET_COMPILER_CYGWIN) || \
+ defined(TARGET_OS_SOLARIS)
#ifndef UNIX
#define UNIX
#endif
+#endif
+
+//
+// OS X's Terminal.app has color handling problems; dark grey is
+// especially bad, so we'll want to remap that. OS X is otherwise
+// Unix-ish, so we shouldn't need other special handling.
+//
+#if defined(TARGET_OS_MACOSX)
#define USE_8_COLOUR_TERM_MAP
#define COL_TO_REPLACE_DARKGREY BLUE
#endif
+//
// FreeBSD
-// There's no /usr/bin/zip in FreeBSD.
-#if defined(FREEBSD)
- #ifndef UNIX
- #define UNIX
- #endif
+//
+#if defined(TARGET_OS_FREEBSD)
+
+ // There's no /usr/bin/zip in FreeBSD.
#define SAVE_PACKAGE_NONE
+
+#endif
+
+//
+// MinGW
+//
+#if defined(TARGET_COMPILER_MINGW)
+ #define REGEX_PCRE
#endif
// =========================================================================
@@ -91,8 +98,10 @@
//
// #define DGAMELAUNCH
+#ifndef TARGET_COMPILER_MINGW
#define MULTIUSER
#define USE_UNIX_SIGNALS
+#endif
// If this is defined, Crawl will attempt to save and exit when it
// receives a hangup signal.
@@ -128,7 +137,9 @@
//
// For now, we'll make it default to on for Linux (who should have
// no problems with compiling this).
+#ifndef TARGET_COMPILER_MINGW
#define USE_MORE_SECURE_SEED
+#endif
// Use POSIX regular expressions
#ifndef REGEX_PCRE
@@ -159,7 +170,7 @@
#include "libunix.h"
-#elif defined(DOS)
+#elif defined(TARGET_OS_DOS)
#define SHORT_FILE_NAMES
#define EOL "\r\n"
#define CHARACTER_SET A_ALTCHARSET
@@ -183,7 +194,7 @@
// linked in. This is optional.
#define REGEX_PCRE
-#elif defined(WIN32CONSOLE) || defined(WIN32TILES)
+#elif defined(TARGET_OS_WINDOWS)
#if defined(WIN32CONSOLE)
#include "libw32c.h"
#endif
diff --git a/crawl-ref/source/Crawl.xcodeproj/project.pbxproj b/crawl-ref/source/Crawl.xcodeproj/project.pbxproj
index afc843f0da..e944fa5f33 100644
--- a/crawl-ref/source/Crawl.xcodeproj/project.pbxproj
+++ b/crawl-ref/source/Crawl.xcodeproj/project.pbxproj
@@ -1943,7 +1943,6 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(PROJECT_DIR)/AppHdr.h";
GCC_PREPROCESSOR_DEFINITIONS = (
- OSX,
CLUA_BINDINGS,
DB_NDBM,
);
@@ -1965,7 +1964,6 @@
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 2;
GCC_PREPROCESSOR_DEFINITIONS = (
- OSX,
DEBUG,
FULLDEBUG,
DEBUG_ITEM_SCAN,
@@ -2070,7 +2068,6 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(PROJECT_DIR)/AppHdr.h";
GCC_PREPROCESSOR_DEFINITIONS = (
- OSX,
CLUA_BINDINGS,
DB_NDBM,
WIZARD,
@@ -2096,7 +2093,6 @@
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
- OSX,
DEBUG,
FULLDEBUG,
DEBUG_ITEM_SCAN,
@@ -2144,7 +2140,6 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(PROJECT_DIR)/AppHdr.h";
GCC_PREPROCESSOR_DEFINITIONS = (
- OSX,
CLUA_BINDINGS,
DB_NDBM,
WIZARD,
@@ -2167,7 +2162,6 @@
ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_PREPROCESSOR_DEFINITIONS = (
- OSX,
WIZARD,
DEBUG,
DEBUG_ITEM_SCAN,
@@ -2214,7 +2208,6 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(PROJECT_DIR)/AppHdr.h";
GCC_PREPROCESSOR_DEFINITIONS = (
- OSX,
CLUA_BINDINGS,
DB_NDBM,
);
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 3f2711455b..c656794bdd 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -15,7 +15,7 @@ REVISION("$Rev$");
#include <stdio.h>
#include <ctype.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 6aaf2c5414..02a5e42ce8 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -29,7 +29,7 @@ REVISION("$Rev$");
#include <sstream>
#include <iostream>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <dos.h>
#include <conio.h>
#include <file.h>
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 6cb2bdf408..63552b960b 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -18,7 +18,7 @@ REVISION("$Rev$");
#include <algorithm>
#include <cmath>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <dos.h>
#include <conio.h>
#endif
diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc
index 35c0aa7904..bc686d06aa 100644
--- a/crawl-ref/source/chardump.cc
+++ b/crawl-ref/source/chardump.cc
@@ -20,7 +20,7 @@ REVISION("$Rev$");
#endif
#include <ctype.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/cio.cc b/crawl-ref/source/cio.cc
index da4367103b..7299d405a7 100644
--- a/crawl-ref/source/cio.cc
+++ b/crawl-ref/source/cio.cc
@@ -156,7 +156,7 @@ void get_input_line( char *const buff, int len )
#else
// [dshaligram] Turn on the cursor for DOS.
-#ifdef DOS
+#ifdef TARGET_OS_DOS
_setcursortype(_NORMALCURSOR);
#endif
@@ -186,7 +186,7 @@ void get_input_line( char *const buff, int len )
// we want to use in cancelable_get_line() and menus.
int c_getch()
{
-#if defined(DOS) || defined(UNIX) || defined(WIN32CONSOLE)
+#if defined(TARGET_OS_DOS) || defined(UNIX) || defined(WIN32CONSOLE)
return getch_ck();
#else
return m_getch();
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 7fd609fe20..211ff61a2f 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -227,7 +227,7 @@ static void _print_version(void)
// Read in information about changes in comparison to the latest version.
FILE* fp = fopen(datafile_path(fname, false).c_str(), "r");
-#if defined(DOS)
+#if defined(TARGET_OS_DOS)
if (!fp)
{
#ifdef DEBUG_FILES
@@ -1976,7 +1976,7 @@ static int _show_keyhelp_menu(const std::vector<formatted_string> &lines,
std::string fname = canonicalise_file_separator(help_files[i].name);
FILE* fp = fopen(datafile_path(fname, false).c_str(), "r");
-#if defined(DOS)
+#if defined(TARGET_OS_DOS)
if (!fp)
{
#ifdef DEBUG_FILES
diff --git a/crawl-ref/source/crash-u.cc b/crawl-ref/source/crash-u.cc
index b7a7007470..052a2ea3ef 100644
--- a/crawl-ref/source/crash-u.cc
+++ b/crawl-ref/source/crash-u.cc
@@ -11,11 +11,17 @@ REVISION("$Rev$");
#include <signal.h>
#endif
-#if (defined(UNIX) || defined(OSX))
+#if defined(UNIX)
#include <cxxabi.h>
-#ifdef OSX
+#if !defined(TARGET_OS_MACOSX) && \
+ !defined(TARGET_OS_WINDOWS) && \
+ !defined(TARGET_COMPILER_CYGWIN)
+#include <execinfo.h>
+#endif
+
+#ifdef TARGET_OS_MACOSX
#include <dlfcn.h>
typedef int (*backtrace_t)(void * *, int);
@@ -28,11 +34,9 @@ template <typename TO, typename FROM> TO nasty_cast(FROM f) {
FROM f; TO t;
} u; u.f = f; return u.t;
}
-#else
-#include <execinfo.h>
-#endif // OSX
+#endif // TARGET_OS_MACOSX
-#endif // defined(UNIX) || defined(OSX)
+#endif // defined(UNIX) || defined(TARGET_OS_MACOSX)
#include "crash.h"
@@ -147,20 +151,22 @@ void init_crash_handler()
void dump_crash_info(FILE* file)
{
+#if defined(UNIX)
const char *name = strsignal(_crash_signal);
if (name == NULL)
name = "INVALID";
fprintf(file, "Crash caused by signal #%d: %s" EOL EOL, _crash_signal,
name);
+#endif
}
-#if (defined(UNIX) || defined(OSX))
+#if defined(UNIX) && !defined(TARGET_COMPILER_CYGWIN)
void write_stack_trace(FILE* file, int ignore_count)
{
void* frames[50];
-#if defined (OSX)
+#if defined (TARGET_OS_MACOSX)
backtrace_t backtrace;
backtrace_symbols_t backtrace_symbols;
backtrace = nasty_cast<backtrace_t, void*>(dlsym(RTLD_DEFAULT, "backtrace"));
@@ -176,7 +182,7 @@ void write_stack_trace(FILE* file, int ignore_count)
int num_frames = backtrace(frames, ARRAYSZ(frames));
char **symbols = backtrace_symbols(frames, num_frames);
-#ifndef OSX
+#if !defined(TARGET_OS_MACOSX)
if (symbols == NULL)
{
fprintf(stderr, "Out of memory." EOL);
@@ -194,7 +200,7 @@ void write_stack_trace(FILE* file, int ignore_count)
// Now we prettify the printout to even show demangled C++ function names.
std::string bt = "";
for (int i = 0; i < num_frames; i++) {
-#if defined (OSX)
+#if defined (TARGET_OS_MACOSX)
char *addr = ::strstr(symbols[i], "0x");
char *mangled = ::strchr(addr, ' ') + 1;
char *offset = ::strchr(addr, '+');
@@ -217,7 +223,7 @@ void write_stack_trace(FILE* file, int ignore_count)
bt += offset;
free(realname);
}
-#else // OSX
+#else // TARGET_OS_MACOSX
bt += symbols[i];
int status;
// Extract the identifier from symbols[i]. It's inside of parens.
@@ -240,7 +246,7 @@ void write_stack_trace(FILE* file, int ignore_count)
free(symbols);
}
-#else // defined(UNIX) || defined(OSX)
+#else // defined(UNIX)
void write_stack_trace(FILE* file, int ignore_count)
{
const char* msg = "Unable to get stack trace on this platform." EOL;
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 37486576e2..0fa8f1b7f0 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -19,7 +19,7 @@ REVISION("$Rev$");
#include <algorithm>
#include <errno.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -102,7 +102,7 @@ static void _dump_levgen();
#if DEBUG
static void _BreakStrToDebugger(const char *mesg)
{
-#if defined(OSX) || defined(__MINGW32__)
+#if defined(TARGET_OS_MACOSX) || defined(TARGET_COMPILER_MINGW)
fprintf(stderr, mesg);
// raise(SIGINT); // this is what DebugStr() does on OS X according to Tech Note 2030
int* p = NULL; // but this gives us a stack crawl...
diff --git a/crawl-ref/source/defines.h b/crawl-ref/source/defines.h
index 5ee9daadd7..2ef5a2fee9 100644
--- a/crawl-ref/source/defines.h
+++ b/crawl-ref/source/defines.h
@@ -177,7 +177,7 @@ const int MAX_SEC_ENCHANT = 2;
#define igrd env.igrid
// colors, such pretty colors ...
-#ifndef DOS
+#ifndef TARGET_OS_DOS
#define BLACK 0
#define BLUE 1
#define GREEN 2
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 009f7635ed..3644ad37f2 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -16,7 +16,7 @@ REVISION("$Rev$");
#include <iomanip>
#include <numeric>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 728deeecb8..b0a162cc62 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -17,7 +17,7 @@ REVISION("$Rev$");
#include <stdio.h>
#include <algorithm>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 14ca371c64..1426d83ad6 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -14,7 +14,7 @@ REVISION("$Rev$");
#include <stdio.h>
#include <algorithm>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index 6068619aba..2e627db619 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -22,7 +22,7 @@ REVISION("$Rev$");
#include <algorithm>
#include <functional>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#include <file.h>
#endif
@@ -32,7 +32,7 @@ REVISION("$Rev$");
#include <unistd.h>
#endif
-#ifdef __MINGW32__
+#ifdef TARGET_COMPILER_MINGW
#include <io.h>
#endif
@@ -88,7 +88,7 @@ REVISION("$Rev$");
#endif
#ifndef HAVE_STAT
-#if defined(UNIX) || defined(__MINGW32__) || defined(DOS)
+#if defined(UNIX) || defined(TARGET_COMPILER_MINGW) || defined(TARGET_OS_DOS)
#define HAVE_STAT
#endif
#endif
@@ -142,7 +142,7 @@ static bool _is_uid_file(const std::string &name, const std::string &ext)
{
std::string save_suffix = get_savedir_filename("", "", "");
save_suffix += ext;
-#ifdef DOS
+#ifdef TARGET_OS_DOS
// Grumble grumble. Hang all retarded operating systems.
uppercase(save_suffix);
#endif
@@ -198,7 +198,7 @@ static inline bool _is_good_filename(const std::string &s)
return (s != "." && s != "..");
}
-#if defined(DOS)
+#if defined(TARGET_OS_DOS)
// Abbreviates a given file name to DOS style "xxxxxx~1.txt".
// Does not take into account files with differing suffixes or files
// with a prepended path with more than one separator.
@@ -409,7 +409,7 @@ static int _create_directory(const char *dir)
{
#if defined(MULTIUSER)
return mkdir(dir, SHARED_FILES_CHMOD_PUBLIC | 0111);
-#elif defined(DOS)
+#elif defined(TARGET_OS_DOS)
return mkdir(dir, 0755);
#elif defined(_MSC_VER)
return _mkdir(dir);
@@ -514,7 +514,7 @@ std::string datafile_path(std::string basename,
#else
!SysEnv.crawl_dir.empty()? SysEnv.crawl_dir : "",
#endif
-#ifdef OSX
+#ifdef TARGET_OS_MACOSX
SysEnv.crawl_base + "../Resources/",
#endif
};
@@ -786,7 +786,7 @@ std::string get_savedir_filename(const std::string &prefix,
result += extension;
}
-#ifdef DOS
+#ifdef TARGET_OS_DOS
uppercase(result);
#endif
return result;
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index faedc59983..31efab4808 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -15,7 +15,7 @@ REVISION("$Rev$");
#include <stdio.h>
#include <ctype.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 42ea9f3a90..ae9f7ca281 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -655,17 +655,17 @@ void game_options::reset_options()
#if defined(SAVE_DIR_PATH)
save_dir = SAVE_DIR_PATH "/saves/";
morgue_dir = SAVE_DIR_PATH "/morgue/";
-#elif defined(OSX)
+#elif defined(TARGET_OS_MACOSX)
std::string tmp_path_base = std::string(getenv("HOME")) + "/Library/Application Support/" CRAWL;
save_dir = tmp_path_base + "/saves/";
morgue_dir = tmp_path_base + "/morgue/";
-#elif !defined(DOS)
+#elif !defined(TARGET_OS_DOS)
save_dir = "saves/";
#else
save_dir.clear();
#endif
-#if !defined(SHORT_FILE_NAMES) && !defined(SAVE_DIR_PATH) && !defined(OSX)
+#if !defined(SHORT_FILE_NAMES) && !defined(SAVE_DIR_PATH) && !defined(TARGET_OS_MACOSX)
morgue_dir = "morgue/";
#endif
@@ -813,7 +813,7 @@ void game_options::reset_options()
#endif
easy_exit_menu = true;
-#ifdef DOS
+#ifdef TARGET_OS_DOS
dos_use_background_intensity = false;
#else
dos_use_background_intensity = true;
@@ -3248,7 +3248,7 @@ std::string game_options::resolve_include(
// favoured file separator.
parent_file = canonicalise_file_separator(parent_file);
included_file = canonicalise_file_separator(included_file);
-#if defined(DOS)
+#if defined(TARGET_OS_DOS)
get_dos_compatible_file_name(&included_file);
#endif
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index da8c03e877..aad492a8cf 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -15,7 +15,7 @@ REVISION("$Rev$");
#include <sstream>
#include <iomanip>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index b17a7fabbd..73dcad74fa 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -14,7 +14,7 @@ REVISION("$Rev$");
#include <ctype.h>
#include <string.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
#include "clua.h"
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 7d5aa3e235..1094b2dd83 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -14,7 +14,7 @@ REVISION("$Rev$");
#include <stdlib.h>
#include <stdio.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index c0dc3d1b20..faf4f7168e 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -16,7 +16,7 @@ REVISION("$Rev$");
#include <stdio.h>
#include <ctype.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/libdos.cc b/crawl-ref/source/libdos.cc
index 00b804f5b5..b14137241a 100644
--- a/crawl-ref/source/libdos.cc
+++ b/crawl-ref/source/libdos.cc
@@ -15,7 +15,7 @@ REVISION("$Rev$");
#include <termios.h>
#include <conio.h>
-#if defined(DOS)
+#if defined(TARGET_OS_DOS)
static bool cursor_is_enabled = true;
@@ -138,4 +138,4 @@ void putwch(unsigned c)
putch(static_cast<char>(c));
}
-#endif /* #if defined(DOS) */
+#endif /* #if defined(TARGET_OS_DOS) */
diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc
index e3aa4e4c6b..b1bae48d62 100644
--- a/crawl-ref/source/libutil.cc
+++ b/crawl-ref/source/libutil.cc
@@ -31,7 +31,7 @@ REVISION("$Rev$");
#ifdef REGEX_PCRE
// Statically link pcre on Windows
- #if defined(WIN32CONSOLE) || defined(WIN32TILES) || defined(DOS)
+ #if defined(WIN32CONSOLE) || defined(WIN32TILES) || defined(TARGET_OS_DOS)
#define PCRE_STATIC
#endif
diff --git a/crawl-ref/source/libw32c.cc b/crawl-ref/source/libw32c.cc
index 9dccba9c83..1c0c4d9b59 100644
--- a/crawl-ref/source/libw32c.cc
+++ b/crawl-ref/source/libw32c.cc
@@ -58,7 +58,7 @@ REVISION("$Rev$");
// END -- WINDOWS INCLUDES
-#ifdef __MINGW32__
+#ifdef TARGET_COMPILER_MINGW
#include <signal.h>
#endif
@@ -289,7 +289,7 @@ static void init_colors(char *windowTitle)
// if not found, quit.
}
-#ifdef __MINGW32__
+#ifdef TARGET_COMPILER_MINGW
static void install_sighandlers()
{
signal(SIGINT, SIG_IGN);
@@ -369,7 +369,7 @@ void init_libw32c(void)
// TODO: Respect changing cursor size manually while Crawl is running.
have_initial_cci = GetConsoleCursorInfo( outbuf, &initial_cci );
-#ifdef __MINGW32__
+#ifdef TARGET_COMPILER_MINGW
install_sighandlers();
#endif
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index 66666a337d..a952dc580f 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -1320,7 +1320,7 @@ int slider_menu::item_colour(int index, const MenuEntry *me) const
int colour = Menu::item_colour(index, me);
if (index == selected && selected != -1)
{
-#if defined(WIN32CONSOLE) || defined(DOS)
+#if defined(WIN32CONSOLE) || defined(TARGET_OS_DOS)
colour = dos_brand(colour, CHATTR_REVERSE);
#elif defined(USE_TILE)
colour = (colour == WHITE ? YELLOW : WHITE);
diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc
index 15782c450c..8f898d8571 100644
--- a/crawl-ref/source/message.cc
+++ b/crawl-ref/source/message.cc
@@ -14,7 +14,7 @@ REVISION("$Rev$");
#include <cstring>
#include <sstream>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 7c7109f8f4..4f0e6f1bf5 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -17,7 +17,7 @@ REVISION("$Rev$");
#include <unistd.h>
#endif
-#ifdef __MINGW32__
+#ifdef TARGET_COMPILER_MINGW
#include <io.h>
#endif
@@ -25,7 +25,7 @@ REVISION("$Rev$");
#include <cstdio>
#include <cmath>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/monspeak.cc b/crawl-ref/source/monspeak.cc
index b0aa1c1ffc..51857107ef 100644
--- a/crawl-ref/source/monspeak.cc
+++ b/crawl-ref/source/monspeak.cc
@@ -13,7 +13,7 @@ REVISION("$Rev$");
#include <stdio.h>
#include <algorithm>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index fae0e43ee8..6ab2d72a55 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -13,7 +13,7 @@ REVISION("$Rev$");
#include <stdio.h>
#include <algorithm>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index 6b92ff0b32..f09120eabb 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -14,7 +14,7 @@ REVISION("$Rev$");
#include <sstream>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index 5b06fe6b86..5edfba55f8 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -16,7 +16,7 @@ REVISION("$Rev$");
#include <time.h>
#include <algorithm>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#include <dos.h>
#endif
@@ -3322,7 +3322,7 @@ static bool _validate_player_name(bool verbose)
bool validate_player_name(const char* name, bool verbose)
{
-#if defined(DOS) || defined(WIN32CONSOLE) || defined(WIN32TILES)
+#if defined(TARGET_OS_DOS) || defined(WIN32CONSOLE) || defined(WIN32TILES)
// Quick check for CON -- blows up real good under DOS/Windows.
if (stricmp(name, "con") == 0
|| stricmp(name, "nul") == 0
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index 205f9b2286..45a31c189c 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -15,7 +15,7 @@ REVISION("$Rev$");
#include <ctype.h>
#include <time.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#include <file.h>
#endif
@@ -28,7 +28,7 @@ REVISION("$Rev$");
#include "ouch.h"
-#ifdef __MINGW32__
+#ifdef TARGET_COMPILER_MINGW
#include <io.h>
#endif
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index fb20fa59c2..7ec43683b7 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -12,7 +12,7 @@ REVISION("$Rev$");
#include <stdlib.h>
#include <sstream>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 4c74fec913..eb15cd7028 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -9,7 +9,7 @@ REVISION("$Rev$");
#include "player.h"
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 4a4e87d300..bb4e37e530 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -16,7 +16,7 @@ REVISION("$Rev$");
#include <stdio.h>
#include <cmath>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <dos.h>
#endif
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc
index ac3b9a091e..c4959d66fd 100644
--- a/crawl-ref/source/shopping.cc
+++ b/crawl-ref/source/shopping.cc
@@ -14,7 +14,7 @@ REVISION("$Rev$");
#include <stdlib.h>
#include <string.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc
index 1cb9fa9d3e..b3465e58be 100644
--- a/crawl-ref/source/skills2.cc
+++ b/crawl-ref/source/skills2.cc
@@ -17,7 +17,7 @@ REVISION("$Rev$");
#include <stdlib.h>
#include <ctype.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index 420684b5be..375fe300e1 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -15,7 +15,7 @@ REVISION("$Rev$");
#include <algorithm>
#include <iomanip>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 17fc6a881f..b4edf1fb05 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -50,7 +50,7 @@ REVISION("$Rev$");
#include "tutorial.h"
#include "view.h"
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc
index 27d1e4169b..b727117eb8 100644
--- a/crawl-ref/source/spl-util.cc
+++ b/crawl-ref/source/spl-util.cc
@@ -35,7 +35,7 @@ REVISION("$Rev$");
#include "terrain.h"
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index d3cf2de31a..0571f3f253 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -48,7 +48,7 @@ REVISION("$Rev$");
#include "sha256.h"
#endif
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -754,7 +754,7 @@ void cio_init()
init_libw32c();
#endif
-#ifdef DOS
+#ifdef TARGET_OS_DOS
init_libdos();
#endif
@@ -827,7 +827,7 @@ void end(int exit_code, bool print_error, const char *format, ...)
error.clear();
}
-#if defined(WIN32CONSOLE) || defined(DOS) || defined(DGL_PAUSE_AFTER_ERROR)
+#if defined(WIN32CONSOLE) || defined(TARGET_OS_DOS) || defined(DGL_PAUSE_AFTER_ERROR)
if (exit_code && !crawl_state.arena
&& !crawl_state.seen_hups && !crawl_state.test)
{
diff --git a/crawl-ref/source/tilesdl.h b/crawl-ref/source/tilesdl.h
index 867c1cf0df..e7cede1863 100644
--- a/crawl-ref/source/tilesdl.h
+++ b/crawl-ref/source/tilesdl.h
@@ -205,7 +205,7 @@ protected:
// Main interface for tiles functions
extern TilesFramework tiles;
-#ifdef __MINGW32__
+#ifdef TARGET_COMPILER_MINGW
#ifndef alloca
// Srsly, MinGW, wtf?
void *alloca(size_t);
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index bdecfa1fae..4eed07c72f 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -55,7 +55,7 @@ REVISION("$Rev$");
#include <memory>
#include <sstream>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <dos.h>
#endif
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 60078af7cd..5a2d319397 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -14,7 +14,7 @@ REVISION("$Rev$");
#include <sstream>
#include <algorithm>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -318,7 +318,7 @@ bool is_notable_terrain(dungeon_feature_type ftype)
return (Feature[ftype].is_notable());
}
-#if defined(WIN32CONSOLE) || defined(DOS) || defined(USE_TILE)
+#if defined(WIN32CONSOLE) || defined(TARGET_OS_DOS) || defined(USE_TILE)
static unsigned _colflag2brand(int colflag)
{
switch (colflag)
@@ -354,7 +354,7 @@ unsigned real_colour(unsigned raw_colour)
if (is_element_colour( raw_colour ))
raw_colour = colflags | element_colour( raw_colour );
-#if defined(WIN32CONSOLE) || defined(DOS) || defined(USE_TILE)
+#if defined(WIN32CONSOLE) || defined(TARGET_OS_DOS) || defined(USE_TILE)
if (colflags)
{
unsigned brand = _colflag2brand(colflags);
@@ -600,7 +600,7 @@ static char _get_travel_colour( const coord_def& p )
Options.tc_disconnected;
}
-#if defined(WIN32CONSOLE) || defined(DOS) || defined(USE_TILE)
+#if defined(WIN32CONSOLE) || defined(TARGET_OS_DOS) || defined(USE_TILE)
static unsigned short _dos_reverse_brand(unsigned short colour)
{
if (Options.dos_use_background_intensity)
diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h
index 6f4dac75ff..9c146226b6 100644
--- a/crawl-ref/source/view.h
+++ b/crawl-ref/source/view.h
@@ -197,7 +197,7 @@ dungeon_char_type dchar_by_name(const std::string &name);
void handle_terminal_resize(bool redraw = true);
-#if defined(WIN32CONSOLE) || defined(DOS) || defined(USE_TILE)
+#if defined(WIN32CONSOLE) || defined(TARGET_OS_DOS) || defined(USE_TILE)
unsigned short dos_brand( unsigned short colour,
unsigned brand = CHATTR_REVERSE);
#endif