Skip to content

Commit 8f42a66

Browse files
authored
Merge branch 'dev' into fix/free_hwnd
2 parents 897bc91 + 9dfffbb commit 8f42a66

File tree

10 files changed

+175
-144
lines changed

10 files changed

+175
-144
lines changed

.github/workflows/PR-notify.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,11 @@ jobs:
4848
echo "Event 类型: ${{ github.event.action }}"
4949
echo "Event 名: ${{ github.event_name }}"
5050
51-
- name: 对 PR 描述点赞
52-
uses: peter-evans/create-or-update-comment@v4
53-
with:
54-
issue-number: ${{ github.event.pull_request.number }}
55-
body: '' # 空body,只添加reaction
56-
reactions: '+1'
51+
# 2025-10-06 移除点赞的步骤
52+
# 因原 peter-evans/create-or-update-comment@v5 已不再支持空body,而如果使用 Github Token 之类又过于大材小用因此移除
5753

5854
- name: 添加评论欢迎 PRer
59-
uses: peter-evans/create-or-update-comment@v4
55+
uses: peter-evans/create-or-update-comment@v5
6056
with:
6157
issue-number: ${{ github.event.pull_request.number }}
6258
body: |

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ xy
4242
fw
4343
README.md.bak*
4444
*.tmp
45+
chsrc_tmp_test.txt
46+
chsrc_tmp_test.txt.bak
4547

4648
# Generated when testing (when there's a bug)
4749
nul

lib/xy.h

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
* -------------------------------------------------------------
55
* Lib Authors : 曾奥然 <[email protected]>
66
* | 郭恒 <[email protected]>
7-
* Contributors : juzeon <skyjuzheng@gmail.com>
8-
* | Mikachu2333 <mikachu.23333@zohomail.com>
7+
* Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
8+
* | juzeon <skyjuzheng@gmail.com>
99
* | BingChunMoLi <[email protected]>
1010
* |
1111
* Created On : <2023-08-28>
12-
* Last Modified : <2025-09-29>
12+
* Last Modified : <2025-10-06>
1313
*
1414
*
1515
* xy: 襄阳、咸阳
@@ -23,7 +23,7 @@
2323
#ifndef XY_H
2424
#define XY_H
2525

26-
#define _XY_Version "v0.2.0.0-2025/08/27"
26+
#define _XY_Version "v0.2.1.0-2025/10/06"
2727
#define _XY_Maintain_URL "https://github.com/RubyMetric/chsrc/blob/dev/lib/xy.h"
2828
#define _XY_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc/blob/dev/lib/xy.h"
2929

@@ -123,6 +123,10 @@ xy =
123123
#define assert_str(a, b) assert (xy_streql ((a), (b)))
124124

125125
#define xy_panic(reason) assert(!reason)
126+
127+
// @flavor Perl, PHP, Raku
128+
#define die xy_panic
129+
126130
#define xy_unsupported() xy_panic("Unsuppoted")
127131
#define xy_unimplemented() xy_panic("Unimplemented temporarily")
128132
#define xy_unreached() xy_panic("This code shouldn't be reached")
@@ -177,7 +181,7 @@ static void _xy_println_const_str (const char *str) {printf ("%s\n", str);}
177181
const char *: _xy_println_const_str, \
178182
default: xy_panic("Unsupported type for println()/say()!") \
179183
)(x)
180-
/* @flavor Perl/Raku */
184+
/* @flavor Raku, Perl */
181185
#define say println
182186
/* @flavor PHP */
183187
#define echo println
@@ -668,10 +672,11 @@ xy_str_find (const char *str, const char *substr)
668672

669673
/**
670674
* @brief 获取字符串下一行的内容
675+
*
671676
* @note 将忽略开头的换行,截取至下一个换行前(不含换行符)
672677
*/
673678
static char *
674-
xy_str_take_until_newline (const char *str)
679+
xy_str_next_nonempty_line (const char *str)
675680
{
676681
if (!str)
677682
return xy_strdup ("");
@@ -696,10 +701,13 @@ xy_str_take_until_newline (const char *str)
696701

697702
/**
698703
* @brief 读取文件内容并返回字符串,失败时返回空字符串
699-
* @note 已处理 `\r\n` 和 `\r`,返回的字符串均为 `\n` 换行
704+
*
705+
* @note 已处理 \r\n 和 \r,返回的字符串均为 \n 换行
706+
*
707+
* @flavor Ruby: IO::read
700708
*/
701709
static char *
702-
xy_file_to_str (const char *path)
710+
xy_file_read (const char *path)
703711
{
704712
FILE *fp = fopen (path, "rb");
705713
if (!fp)

src/chsrc-main.c

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

33-
#define Chsrc_Version "0.2.2.5-dev1"
34-
#define Chsrc_Release_Date "2025/09/19"
33+
#define Chsrc_Version "0.2.3"
34+
#define Chsrc_Release_Date "2025/10/06"
3535
#define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc"
3636
#define Chsrc_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc"
3737

@@ -337,6 +337,41 @@ cli_print_target_features (Target_t *target, const char *input_target_name)
337337
}
338338

339339

340+
/**
341+
* @brief 简略打印维护信息
342+
*
343+
* 用于 chsrc get/set/reset <target>
344+
*/
345+
void
346+
cli_print_target_maintain_info_briefly (Target_t *target, const char *input_target_name)
347+
{
348+
if (target->sources_last_updated)
349+
{
350+
char *msg = ENGLISH ? "Ingredient(Sources) Last Updated: " : "食源检查: ";
351+
printf ("%s%s ", msg, purple(target->sources_last_updated));
352+
}
353+
354+
if (target->last_updated)
355+
{
356+
char *msg = ENGLISH ? "Recipe Last Updated: " : "食谱更新: ";
357+
printf ("%s%s ", msg, purple(target->last_updated));
358+
}
359+
360+
char num[32]; sprintf(num, "%d", target->cooks_n + target->sauciers_n);
361+
char *msg = ENGLISH ? "Contributors: " : "后厨人数: ";
362+
printf ("%s%s ", msg, purple(num));
363+
364+
msg = ENGLISH ? xy_strcat (3, "(See chsrc ls ", input_target_name, ")")
365+
: xy_strcat (3, "(详查 chsrc ls ", input_target_name, ")");
366+
printf ("%s\n", msg);
367+
}
368+
369+
370+
/**
371+
* @brief 详细打印维护信息
372+
*
373+
* 用于 chsrc ls <target>
374+
*/
340375
void
341376
cli_print_target_maintain_info (Target_t *target, const char *input_target_name)
342377
{
@@ -640,10 +675,10 @@ get_target (const char *input, TargetOp code, char *option)
640675
return true;
641676
}
642677

678+
/* 简短显示维护信息 */
643679
if (TargetOp_Get_Source==code || TargetOp_Set_Source==code || TargetOp_Reset_Source==code)
644680
{
645-
br();
646-
cli_print_target_maintain_info (target, input);
681+
cli_print_target_maintain_info_briefly (target, input);
647682
}
648683

649684
if (TargetOp_Set_Source==code || TargetOp_Measure_Source==code)

src/framework/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ chsrc_determine_chgtype (ChgType_t type)
11471147
#define MSG_EN_STILL "Still need to operate manually according to the above prompts. "
11481148
#define MSG_CN_STILL "仍需按上述提示手工操作"
11491149

1150-
#define thank_mirror(msg) chsrc_log(xy_2strcat(msg,purple(ENGLISH?source->mirror->abbr:source->mirror->name)))
1150+
#define thank_mirror(msg) say(xy_2strcat(msg,purple(ENGLISH?source->mirror->abbr:source->mirror->name)))
11511151

11521152
/**
11531153
* @param source 可为NULL
@@ -1751,7 +1751,7 @@ chsrc_append_to_file (const char *str, const char *filename)
17511751
}
17521752

17531753
/**
1754-
* @note 本函数不会自动在 str 末尾添加换行符
1754+
* @note 本函数不会自动在 `str` 末尾添加换行符
17551755
*/
17561756
static void
17571757
chsrc_prepend_to_file (const char *str, const char *filename)

0 commit comments

Comments
 (0)