Skip to content

Commit e6d512e

Browse files
committed
重命名为 XY_Build_On_xx
1 parent 9d7543b commit e6d512e

File tree

5 files changed

+20
-13
lines changed

5 files changed

+20
-13
lines changed

doc/03-为什么拒绝使用代码格式化工具.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ if (!matched) matched = iterate_menu (chsrc_wr_menu, input, &target_tmp);
7070

7171
```c
7272
#ifdef _WIN32
73-
#define XY_On_Windows 1
73+
#define XY_Build_On_Windows 1
7474
#define xy_on_windows true
7575
#ifdef XY_DEBUG
7676
#define xy_debug_mode 1

lib/xy.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ bool xy_enable_color = true;
6262
// #define NDEBUG
6363

6464
#ifdef _WIN32
65-
#define XY_On_Windows 1
65+
#define XY_Build_On_Windows 1
66+
6667
#define xy_on_windows true
6768
#define xy_on_linux false
6869
#define xy_on_macos false
@@ -73,7 +74,9 @@ bool xy_enable_color = true;
7374
#define xy_use_utf8() SetConsoleOutputCP (65001)
7475

7576
#elif defined(__linux__) || defined(__linux)
76-
#define XY_On_Linux 1
77+
#define XY_Build_On_Linux 1
78+
#define XY_Build_On_Unix 1
79+
7780
#define xy_on_windows false
7881
#define xy_on_linux true
7982
#define xy_on_macos false
@@ -82,7 +85,9 @@ bool xy_enable_color = true;
8285
#define xy_use_utf8()
8386

8487
#elif defined(__APPLE__)
85-
#define XY_On_macOS 1
88+
#define XY_Build_On_macOS 1
89+
#define XY_Build_On_Unix 1
90+
8691
#define xy_on_windows false
8792
#define xy_on_linux false
8893
#define xy_on_macos true
@@ -91,7 +96,9 @@ bool xy_enable_color = true;
9196
#define xy_use_utf8()
9297

9398
#elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
94-
#define XY_On_BSD 1
99+
#define XY_Build_On_BSD 1
100+
#define XY_Build_On_Unix 1
101+
95102
#define xy_on_windows false
96103
#define xy_on_linux false
97104
#define xy_on_macos false
@@ -916,7 +923,7 @@ _xy_os_home ()
916923
static char *
917924
_xy_win_documents ()
918925
{
919-
#ifdef XY_On_Windows
926+
#ifdef XY_Build_On_Windows
920927
char documents_path[MAX_PATH];
921928
HRESULT result = SHGetFolderPathA (NULL, CSIDL_MYDOCUMENTS, NULL,
922929
SHGFP_TYPE_CURRENT, documents_path);
@@ -1009,7 +1016,7 @@ xy_dir_exist (const char *path)
10091016

10101017
if (xy_on_windows)
10111018
{
1012-
#ifdef XY_On_Windows
1019+
#ifdef XY_Build_On_Windows
10131020
// 也可以用 opendir() #include <dirent.h>
10141021
DWORD attr = GetFileAttributesA (dir);
10151022

src/framework/core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ chsrc_run_as_a_service (const char *cmd)
13381338
FILE *
13391339
chsrc_make_tmpfile (char *filename, char *postfix, bool loud, char **tmpfilename)
13401340
{
1341-
#ifdef XY_On_Windows
1341+
#ifdef XY_Build_On_Windows
13421342
/**
13431343
* Windows 上没有 mkstemps(),只有 mkstemp() 和 _mktemp_s(),这后两者效果是等价的,只不过传参不同,
13441344
* 这意味着我们无法给一个文件名后缀(postfix),只能生成一个临时文件名
@@ -1489,7 +1489,7 @@ chsrc_view_env (const char *var1, ...)
14891489
bool first = true;
14901490
while (var)
14911491
{
1492-
#ifdef XY_On_Windows
1492+
#ifdef XY_Build_On_Windows
14931493
if (first)
14941494
{
14951495
cmd = xy_strcat (3, "set ", var, " ");
@@ -1757,7 +1757,7 @@ chsrc_get_cpuarch ()
17571757
char *ret;
17581758
char *msg;
17591759

1760-
#if XY_On_Windows
1760+
#if XY_Build_On_Windows
17611761
SYSTEM_INFO info;
17621762
GetSystemInfo (&info);
17631763
WORD num = info.wProcessorArchitecture;
@@ -1810,7 +1810,7 @@ chsrc_get_cpucore ()
18101810
{
18111811
int cores = 2;
18121812

1813-
#if XY_On_Windows
1813+
#if XY_Build_On_Windows
18141814
SYSTEM_INFO info;
18151815
GetSystemInfo (&info);
18161816
DWORD num = info.dwNumberOfProcessors;

src/recipe/lang/Python/uv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pl_python_uv_setsrc (char *option)
125125

126126
const char *source_content = xy_str_gsub (RAWSTR_pl_python_uv_config_source_content, "@url@", source.url);
127127

128-
#if defined(XY_On_macOS) || defined(XY_On_BSD)
128+
#if defined(XY_Build_On_macOS) || defined(XY_Build_On_BSD)
129129
char *sed_cmd = "sed -i '' ";
130130
#else
131131
char *sed_cmd = "sed -i ";

src/recipe/lang/Rust/rustup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pl_rust_rustup_setsrc (char *option)
6262
{
6363
use_this_source(pl_rust_rustup);
6464

65-
#ifdef XY_On_Windows
65+
#ifdef XY_Build_On_Windows
6666

6767
char *cmd1 = xy_strcat (3, "setx RUSTUP_DIST_SERVER \"", source.url, "\"");
6868
char *cmd2 = xy_strcat (3, "setx RUSTUP_UPDATE_ROOT \"", source.url, "/rustup\"");

0 commit comments

Comments
 (0)