OSDN Git Service

Merge pull request #3806 from Slimebreath6078/feature/Add_chaos_blow
[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 #ifdef JP
34 #define iseuckanji(x) (((unsigned char)(x) >= 0xa1 && (unsigned char)(x) <= 0xfe) || (unsigned char)(x) == 0x8e)
35 #endif
36 #undef PATH_SEP
37 #ifdef WINDOWS
38   #define PATH_SEP "\\"
39   #ifdef JP
40     #define iskanji(x) ((0x81 <= (unsigned char)(x) && (unsigned char)(x) <= 0x9f) || (0xe0 <= (unsigned char)(x) && (unsigned char)(x) <= 0xfc))
41     #define iskana(x) (((unsigned char)(x) >= 0xA0) && ((unsigned char)(x) <= 0xDF))
42   #endif
43 #else
44   #define PATH_SEP "/"
45   #define SET_UID
46   #define PRIVATE_USER_PATH "~/.angband"
47   #define SAVEFILE_USE_UID
48   
49   #if !defined(HAVE_CONFIG_H)
50     #define HAVE_USLEEP
51   #endif
52   
53   #define SAFE_SETUID
54   /* Pick up system's definition of _POSIX_SAVED_IDS. */
55   #include <unistd.h>
56   #ifdef _POSIX_SAVED_IDS
57     #define SAFE_SETUID_POSIX
58   #endif
59   
60   #ifndef DEFAULT_LIB_PATH
61     #define DEFAULT_LIB_PATH "./lib/"
62   #endif
63   
64   #ifdef USE_XFT
65     #ifdef JP
66       #define DEFAULT_X11_FONT "monospace-24:lang=ja:spacing=90"
67       #define DEFAULT_X11_FONT_SUB "sans-serif-16:lang=ja"
68     #else
69       #define DEFAULT_X11_FONT "monospace-24:lang=en:spacing=90"
70       #define DEFAULT_X11_FONT_SUB "sans-serif-16:lang=en"
71     #endif
72   #else
73     #ifdef JP
74       #define DEFAULT_X11_FONT "-*-*-medium-r-normal--24-*-*-*-*-*-iso8859-1,-*-*-medium-r-normal--24-*-*-*-*-*-jisx0208.1983-0"
75       #define DEFAULT_X11_FONT_SUB "-*-*-medium-r-normal--16-*-*-*-*-*-iso8859-1,-*-*-medium-r-normal--16-*-*-*-*-*-jisx0208.1983-0"
76     #else
77       #define DEFAULT_X11_FONT "-*-*-medium-r-normal--24-*-*-*-*-*-iso8859-1"
78       #define DEFAULT_X11_FONT_SUB "-*-*-medium-r-normal--16-*-*-*-*-*-iso8859-1"
79     #endif
80   #endif
81   
82   #define DEFAULT_X11_FONT_0 DEFAULT_X11_FONT
83   #define DEFAULT_X11_FONT_1 DEFAULT_X11_FONT_SUB
84   #define DEFAULT_X11_FONT_2 DEFAULT_X11_FONT_SUB
85   #define DEFAULT_X11_FONT_3 DEFAULT_X11_FONT_SUB
86   #define DEFAULT_X11_FONT_4 DEFAULT_X11_FONT_SUB
87   #define DEFAULT_X11_FONT_5 DEFAULT_X11_FONT_SUB
88   #define DEFAULT_X11_FONT_6 DEFAULT_X11_FONT_SUB
89   #define DEFAULT_X11_FONT_7 DEFAULT_X11_FONT_SUB
90   
91   #ifdef JP
92     #ifdef EUC
93       #define iskanji(x) (iseuckanji(x))
94       #define iskana(x) (0)
95     #else
96       #error Oops! Please define "EUC" for kanji-code of your system.
97     #endif
98   #endif
99   
100   #ifndef HAVE_CONFIG_H
101     #ifdef JP
102     #define USE_XIM
103     #endif
104   
105     #if defined(USE_XIM)
106     #define USE_LOCALE
107     #endif
108   #endif
109 #endif
110
111 // clang-format on
112
113 #if !defined(__GNUC__)
114 #define __attribute__(x)
115 #endif