cordle/include/platform.h

54 lines
1.3 KiB
C
Raw Normal View History

2026-01-26 14:29:55 +00:00
/* platform.h - Platform-specific compatibility definitions */
#ifndef PLATFORM_H
#define PLATFORM_H
/* Platform detection */
#if defined(__MSDOS__) || defined(_MSDOS) || defined(__DOS__) || defined(MSDOS)
#define PLATFORM_DOS 1
#else
#define PLATFORM_UNIX 1
#endif
/* Include appropriate curses library */
#ifdef PLATFORM_DOS
#include <conio.h>
/* PDCurses on DOS uses curses.h */
#include <curses.h>
/* DOS path definitions */
#define PATH_SEP "\\"
#define WORDLIST_PATH_1 "words"
#define WORDLIST_PATH_2 "C:\\CORDLE\\words"
#define WORDLIST_PATH_4 "D:\\CORDLE\\words"
2026-01-26 14:29:55 +00:00
#define WORDLIST_PATH_3 NULL
/* DOS doesn't have HOME environment variable */
#define HAS_HOME_ENV 0
#else
/* Unix/Linux/macOS */
#include <curses.h>
/* Unix path definitions */
#define PATH_SEP "/"
#define WORDLIST_PATH_1 "words"
#define WORDLIST_PATH_2 "/usr/local/share/cordle/words"
#define WORDLIST_PATH_3_FMT "%s/.local/share/cordle/words"
2026-01-26 14:29:55 +00:00
#define HAS_HOME_ENV 1
#endif
/* Color code compatibility */
#ifdef PLATFORM_DOS
/* PDCurses uses different color constants on some platforms */
#ifndef COLOR_WWHITE
#define COLOR_WWHITE COLOR_WHITE
#endif
#else
/* ncurses compatibility */
#ifndef COLOR_WWHITE
#define COLOR_WWHITE COLOR_WHITE
#endif
#endif
#endif /* PLATFORM_H */