OSDN Git Service

[Refactor] 敵魔法から属性を取得するための基底クラスを追加
[hengbandforosx/hengbandosx.git] / src / system / h-config.h
1 /*!
2  * @file h-config.h
3  * @brief OSごとの差異を吸収してコンパイルするためのプリプロ群
4  * The most basic "include" file.
5  * This file simply includes other low level header files.
6  * @date 2021/08/26
7  * @author Hourier
8  * @details
9  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
10  */
11
12 #pragma once
13
14 // @todo このアドレスもそろそろ変えた方が良い気がする.
15 // そもそもこのご時世にメールによる連絡を試みるか?
16 constexpr auto MAINTAINER = "echizen@users.sourceforge.jp";
17
18 // clang-format off
19
20 #if defined(WIN32) && !defined(WINDOWS)
21 #define WINDOWS
22 #endif
23
24 /*
25  * @details
26  * WindowsはShift-JIS (ひらがなや漢字が全て2バイト/文字)で定義されていることとする.
27  * Unix系はEUC (ひらがなや漢字が全て2バイト/文字)で定義されていることとする.
28  * これらは、このゲームがUTF系の可変長文字列に非対応であるためである.
29  * Unix系は、マルチユーザ対応としてSET_UIDを定義する.
30  * フォントやデフォルトのlibパス等も定義する.
31  * HAVE_CONFIG_Hは、autoconfによりコンパイラスイッチ「-DHAVE_CONFIG_H」が付加される.
32  */
33 #undef PATH_SEP
34 #ifdef WINDOWS
35   #define PATH_SEP "\\"
36   #ifdef JP
37     #define iskanji(x) ((0x81 <= (unsigned char)(x) && (unsigned char)(x) <= 0x9f) || (0xe0 <= (unsigned char)(x) && (unsigned char)(x) <= 0xfc))
38     #define iskana(x) (((unsigned char)(x) >= 0xA0) && ((unsigned char)(x) <= 0xDF))
39   #endif
40 #else
41   #define PATH_SEP "/"
42   #define SET_UID
43   #define PRIVATE_USER_PATH "~/.angband"
44   #define SAVEFILE_USE_UID
45   
46   #if !defined(HAVE_CONFIG_H)
47     #define HAVE_USLEEP
48   #endif
49   
50   #define SAFE_SETUID
51   /* Pick up system's definition of _POSIX_SAVED_IDS. */
52   #include <unistd.h>
53   #ifdef _POSIX_SAVED_IDS
54     #define SAFE_SETUID_POSIX
55   #endif
56   
57   #ifndef DEFAULT_LIB_PATH
58     #define DEFAULT_LIB_PATH "./lib/"
59   #endif
60   
61   #ifndef DEFAULT_VAR_PATH
62     #define DEFAULT_VAR_PATH DEFAULT_LIB_PATH
63   #endif
64   
65   #ifdef USE_XFT
66     #ifdef JP
67       #define DEFAULT_X11_FONT "monospace-24:lang=ja:spacing=90"
68       #define DEFAULT_X11_FONT_SUB "sans-serif-16:lang=ja"
69     #else
70       #define DEFAULT_X11_FONT "monospace-24:lang=en:spacing=90"
71       #define DEFAULT_X11_FONT_SUB "sans-serif-16:lang=en"
72     #endif
73   #else
74     #ifdef JP
75       #define DEFAULT_X11_FONT "-*-*-medium-r-normal--24-*-*-*-*-*-iso8859-1,-*-*-medium-r-normal--24-*-*-*-*-*-jisx0208.1983-0"
76       #define DEFAULT_X11_FONT_SUB "-*-*-medium-r-normal--16-*-*-*-*-*-iso8859-1,-*-*-medium-r-normal--16-*-*-*-*-*-jisx0208.1983-0"
77     #else
78       #define DEFAULT_X11_FONT "-*-*-medium-r-normal--24-*-*-*-*-*-iso8859-1"
79       #define DEFAULT_X11_FONT_SUB "-*-*-medium-r-normal--16-*-*-*-*-*-iso8859-1"
80     #endif
81   #endif
82   
83   #define DEFAULT_X11_FONT_0 DEFAULT_X11_FONT
84   #define DEFAULT_X11_FONT_1 DEFAULT_X11_FONT_SUB
85   #define DEFAULT_X11_FONT_2 DEFAULT_X11_FONT_SUB
86   #define DEFAULT_X11_FONT_3 DEFAULT_X11_FONT_SUB
87   #define DEFAULT_X11_FONT_4 DEFAULT_X11_FONT_SUB
88   #define DEFAULT_X11_FONT_5 DEFAULT_X11_FONT_SUB
89   #define DEFAULT_X11_FONT_6 DEFAULT_X11_FONT_SUB
90   #define DEFAULT_X11_FONT_7 DEFAULT_X11_FONT_SUB
91   
92   #ifdef JP
93     #ifdef EUC
94       #define iskanji(x) (((unsigned char)(x) >= 0xa1 && (unsigned char)(x) <= 0xfe) || (unsigned char)(x) == 0x8e)
95       #define iskana(x) (0)
96     #else
97       #error Oops! Please define "EUC" for kanji-code of your system.
98     #endif
99   #endif
100   
101   #ifndef HAVE_CONFIG_H
102     #ifdef JP
103     #define USE_XIM
104     #endif
105   
106     #if defined(USE_XIM)
107     #define USE_LOCALE
108     #endif
109   #endif
110 #endif
111
112 // clang-format on