Skip to content

Commit d84bdba

Browse files
authored
Merge branch 'dev' into fix/free_hwnd
2 parents 990b8d0 + c6897bd commit d84bdba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+231
-129
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*.dll
2323
*.out
2424
*.exe
25-
25+
*.res
2626

2727

2828
##############################

Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
# --------------------------------------------------------------
33
# SPDX-License-Identifier: GPL-3.0-or-later
44
# --------------------------------------------------------------
5-
# Build File : Makefile
6-
# File Authors : Aoran Zeng <[email protected]>
7-
# Contributors : Yangmoooo <[email protected]>
5+
# Build File : Makefile
6+
# File Authors : 曾奥然 <[email protected]>
7+
# Contributors : Yangmoooo <[email protected]>
88
# | sanchuanhehe <[email protected]>
99
# |
1010
# Created On : <2023-08-28>
11-
# Last Modified : <2025-07-22>
11+
# Last Modified : <2025-10-15>
1212
#
1313
# 请阅读 ./doc/01-开发与构建.md 来使用
1414
# --------------------------------------------------------------
@@ -26,10 +26,12 @@ ifeq ($(shell uname), Darwin)
2626
On-macOS = 1
2727
endif
2828

29-
# 只有Windows会定义$(OS)变量
29+
# 只有 MSYS2 会定义 $(OS) 变量
3030
ifeq ($(OS), Windows_NT)
3131
On-Windows = 1
3232
endif
33+
# 注意, 原生 Windows 会定义 $(ComSpec) 变量,且区分大小写
34+
# 但是 MSYS2 并不会定义
3335
#=====================================
3436

3537

@@ -196,6 +198,7 @@ test-cli: $(DevMode-Target-Name)
196198

197199
clean:
198200
-@rm *.exe 2>/dev/null
201+
-@rm *.res 2>/dev/null
199202
-@rm xy 2>/dev/null
200203
-@rm fw 2>/dev/null
201204
-@rm README.md.bak* 2>/dev/null

doc/01-开发与构建.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
! -------------------------------------------------------------
44
! Doc Type : Markdown
55
! Doc Name : 01-开发与构建.md
6-
! Doc Authors : 曾奥然 <[email protected]>
7-
! Contributors : Nul None <[email protected]>
6+
! Doc Authors : 曾奥然 <[email protected]>
7+
! Contributors : Mikachu2333 <[email protected]>
88
! |
99
! Created On : <2024-12-27>
10-
! Last Modified : <2025-08-22>
10+
! Last Modified : <2025-10-11>
1111
! ---------------------------------------------------------- -->
1212

1313
# 开发 chsrc

doc/image/chsrc.svg

Lines changed: 9 additions & 0 deletions
Loading

justfile

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# --------------------------------------------------------------
33
# SPDX-License-Identifier: GPL-3.0-or-later
44
# --------------------------------------------------------------
5-
# Build File : justfile
6-
# File Authors : Aoran Zeng <[email protected]>
7-
# Contributors : Nul None <[email protected]>
8-
# |
5+
# Build File : justfile
6+
# File Authors : 曾奥然 <[email protected]>
7+
# Contributors : Mikachu2333 <[email protected]>
8+
# |
99
# Created On : <2025-06-18>
10-
# Last Modified : <2025-07-21>
10+
# Last Modified : <2025-10-15>
1111
#
1212
# 该文件主要用于在原生Windows上执行项目的基本任务,而不借助于
1313
# GNU make 以及相应的 MSYS2、Cygwin 环境
@@ -104,19 +104,27 @@ alias c := clean
104104
default: build-in-dev-mode
105105

106106
build-in-dev-mode:
107-
@echo Starting: Build in DEV mode: '{{CC}}' {{CFLAGS_dev_mode_prompt}} -o {{DevMode-Target-Name}}
108-
@{{CC}} src/chsrc-main.c {{CFLAGS_dev_mode}} -o {{DevMode-Target-Name}}
109-
@echo Finished: Build in DEV mode
107+
@echo Starting: Build in DEV mode: '{{CC}}' {{CFLAGS_dev_mode_prompt}} -o {{DevMode-Target-Name}}
108+
@{{CC}} src/chsrc-main.c {{CFLAGS_dev_mode}} -o {{DevMode-Target-Name}}
109+
@echo Finished: Build in DEV mode
110110

111111
build-in-debug-mode:
112112
@echo Starting: Build in DEBUG mode: '{{CC}}' {{CFLAGS_debug_mode_prompt}} -o {{DebugMode-Target-Name}}
113113
@{{CC}} src/chsrc-main.c {{CFLAGS_debug_mode}} -o {{DebugMode-Target-Name}}
114114
@echo Finished: Build in DEBUG mode
115115

116116
build-in-release-mode:
117-
@echo Starting: Build in RELEASE mode: '{{CC}}' {{CFLAGS_release_mode_prompt}} -o {{ReleaseMode-Target-Name}}
118-
@{{CC}} src/chsrc-main.c {{CFLAGS_release_mode}} -o {{ReleaseMode-Target-Name}}
119-
@echo Finished: Build in RELEASE mode
117+
@echo Starting: Build in RELEASE mode: '{{CC}}' {{CFLAGS_release_mode_prompt}} -o {{ReleaseMode-Target-Name}}
118+
@{{ if os() == 'windows' { \
119+
'(if exist chsrc.res del chsrc.res)' + \
120+
' & windres src/resource/chsrc.rc -O coff -o chsrc.res' \
121+
} else { '' } }}
122+
@{{ if os() == 'windows' { \
123+
CC + ' src/chsrc-main.c chsrc.res ' + CFLAGS_release_mode + ' -o ' + ReleaseMode-Target-Name \
124+
} else { \
125+
CC + ' src/chsrc-main.c ' + CFLAGS_release_mode + ' -o ' + ReleaseMode-Target-Name \
126+
} }}
127+
@echo Finished: Build in RELEASE mode
120128

121129
debug: build-in-debug-mode
122130
@{{DEBUGGER}} {{DebugMode-Target-Name}}
@@ -140,6 +148,7 @@ test-cli:
140148

141149
clean:
142150
-@{{BIN_rm}} *.exe
151+
-@{{BIN_rm}} *.res
143152
-@{{BIN_rm}} xy
144153
-@{{BIN_rm}} fw
145154
-@{{BIN_rm}} chsrc

lib/xy.h

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* | BingChunMoLi <[email protected]>
1010
* |
1111
* Created On : <2023-08-28>
12-
* Last Modified : <2025-10-07>
12+
* Last Modified : <2025-10-15>
1313
*
1414
*
1515
* xy: 襄阳、咸阳
@@ -122,15 +122,24 @@ xy =
122122

123123
#define assert_str(a, b) assert (xy_streql ((a), (b)))
124124

125-
#define xy_panic(reason) assert(!reason)
125+
#define xy_throw(reason) assert(!reason)
126126

127-
// @flavor Perl, PHP, Raku
128-
#define die xy_panic
127+
/**
128+
* @depreacated 避免消极用语
129+
*
130+
* @flavor Perl, PHP, Raku
131+
*/
132+
// #define die xy_throw
129133

130-
#define xy_unsupported() xy_panic("Unsuppoted")
131-
#define xy_unimplemented() xy_panic("Unimplemented temporarily")
132-
#define xy_unreached() xy_panic("This code shouldn't be reached")
133-
#define xy_cant_be_null(p) if(!p) xy_panic("This pointer can't be null")
134+
/**
135+
* @depreacated 避免消极用语
136+
*/
137+
// #define xy_panic xy_throw
138+
139+
#define xy_unsupported() xy_throw("Unsuppoted")
140+
#define xy_unimplemented() xy_throw("Unimplemented temporarily")
141+
#define xy_unreached() xy_throw("This code shouldn't be reached")
142+
#define xy_cant_be_null(p) if(!p) xy_throw("This pointer can't be null")
134143

135144

136145

@@ -164,7 +173,7 @@ static void _xy_println_const_str (const char *str) {printf ("%s\n", str);}
164173
bool: _xy_print_bool, \
165174
char *: _xy_print_str, \
166175
const char *: _xy_print_const_str, \
167-
default: xy_panic("Unsupported type for print()!") \
176+
default: xy_throw("Unsupported type for print()!") \
168177
)(x)
169178

170179
/**
@@ -179,7 +188,7 @@ static void _xy_println_const_str (const char *str) {printf ("%s\n", str);}
179188
bool: _xy_println_bool, \
180189
char *: _xy_println_str, \
181190
const char *: _xy_println_const_str, \
182-
default: xy_panic("Unsupported type for println()/say()!") \
191+
default: xy_throw("Unsupported type for println()/say()!") \
183192
)(x)
184193
/* @flavor Raku, Perl */
185194
#define say println
@@ -1332,18 +1341,21 @@ xy_detect_os ()
13321341
char buf[256] = {0};
13331342
fread (buf, 1, sizeof (buf) - 1, fp);
13341343
fclose (fp);
1335-
if (strstr (buf, "Android"))
1336-
{
1337-
xy.on_android = true;
1338-
return;
1339-
}
1340-
else if (strstr (buf, "Linux"))
1344+
if (strstr (buf, "Linux"))
13411345
{
13421346
xy.on_linux = true;
13431347
return;
13441348
}
13451349
}
13461350

1351+
// @consult https://android.googlesource.com/platform/system/core/+/refs/heads/main/rootdir/init.environ.rc.in
1352+
char *android_env = getenv ("ANDROID_ROOT");
1353+
if (xy_str_find (android_env, "/system").found)
1354+
{
1355+
xy.on_android = true;
1356+
return;
1357+
}
1358+
13471359
/* 判断 macOS */
13481360
DIR *d = opendir ("/System/Applications");
13491361
if (d)
@@ -1354,6 +1366,7 @@ xy_detect_os ()
13541366
{
13551367
xy.on_macos = true;
13561368
closedir (d);
1369+
return;
13571370
}
13581371
}
13591372

@@ -1376,10 +1389,11 @@ xy_detect_os ()
13761389
pclose (fp);
13771390
if (strstr (buf, "BSD") != NULL)
13781391
xy.on_bsd = true;
1392+
return;
13791393
}
13801394

13811395
if (!(xy.on_windows || xy.on_linux || xy.on_android || xy.on_macos || xy.on_bsd))
1382-
xy_panic ("Unknown operating system");
1396+
xy_throw ("Unknown operating system");
13831397
}
13841398

13851399

@@ -1488,7 +1502,7 @@ xy_seq_at (XySeq_t *seq, int n)
14881502
{
14891503
xy_cant_be_null (seq);
14901504

1491-
if (0 == n) xy_panic ("The index must begin from 1, not 0");
1505+
if (0 == n) xy_throw ("The index must begin from 1, not 0");
14921506

14931507
if (1 == n) return seq->first_item ? seq->first_item->data : NULL;
14941508

src/chsrc-main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@
3030
* 然的加入,逐渐成长为互相支持的伙伴。
3131
* ------------------------------------------------------------*/
3232

33-
#define Chsrc_Version "0.2.3"
34-
#define Chsrc_Release_Date "2025/10/06"
3533
#define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc"
3634
#define Chsrc_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc"
3735

36+
#include "framework/version.h"
3837
#include "framework/core.c"
3938
#include "framework/chef.c"
4039

src/framework/chef.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* File Authors : 曾奥然 <[email protected]>
66
* Contributors : BingChunMoLi <[email protected]>
77
* Created On : <2025-08-09>
8-
* Last Modified : <2025-08-27>
8+
* Last Modified : <2025-10-27>
99
*
1010
* chef DSL: for chefs (recipe makers) to define a target
1111
* ------------------------------------------------------------*/
@@ -186,7 +186,7 @@ chef_allow_english (Target_t *target)
186186
}
187187

188188
void
189-
chef_forbid_english (Target_t *target)
189+
chef_deny_english (Target_t *target)
190190
{
191191
xy_cant_be_null (target);
192192
target->can_english = false;
@@ -226,7 +226,7 @@ chef_allow_user_define (Target_t *target)
226226
}
227227

228228
void
229-
chef_forbid_user_define (Target_t *target)
229+
chef_deny_user_define (Target_t *target)
230230
{
231231
xy_cant_be_null (target);
232232

src/framework/version.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/** ------------------------------------------------------------
2+
* SPDX-License-Identifier: GPL-3.0-or-later
3+
* -------------------------------------------------------------
4+
* File Name : version.h
5+
* File Authors : 曾奥然 <[email protected]>
6+
* | Mikachu2333 <[email protected]>
7+
* Contributors : Nil Null <[email protected]>
8+
* |
9+
* Created On : <2025-10-10>
10+
* Last Modified : <See 'Chsrc_Release_Date'>
11+
*
12+
* 发布新版本前请修改此文件
13+
* ------------------------------------------------------------*/
14+
15+
#define Chsrc_Version "0.2.3.1-dev1"
16+
17+
// 以下四个宏仅用于 resource/chsrc.rc
18+
#define Chsrc_Version_Major 0
19+
#define Chsrc_Version_Minor 2
20+
#define Chsrc_Version_Patch 3
21+
#define Chsrc_Version_Pre 1
22+
23+
#define Chsrc_Release_Date "2025/10/15"

src/recipe/lang/Clojure.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pl_clojure_prelude ()
1818
chef_set_sauciers (this, 1, "@hezonglun");
1919

2020
chef_allow_local_mode (this, FullyCan, NULL, NULL);
21-
chef_forbid_english(this);
21+
chef_deny_english(this);
2222
chef_allow_user_define(this);
2323

2424
def_sources_begin()

0 commit comments

Comments
 (0)