From fbca61a7e21fbf84f9b820ad07bfc0d09c9e8cf7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 17 Aug 2025 09:33:22 +0800 Subject: [PATCH 001/103] Bump actions/checkout from 4 to 5 (#254) Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/PR-test.yml | 4 ++-- .github/workflows/build-on-Linux-x64.yml | 2 +- .github/workflows/build-on-Windows.yml | 2 +- .github/workflows/build-on-macOS.yml | 4 ++-- .github/workflows/pkg-deb.yml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/PR-test.yml b/.github/workflows/PR-test.yml index d90fab7..644f528 100644 --- a/.github/workflows/PR-test.yml +++ b/.github/workflows/PR-test.yml @@ -31,7 +31,7 @@ jobs: steps: - name: 检出代码 - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: 测试构建情况 run: | @@ -48,7 +48,7 @@ jobs: steps: - name: 检出代码 - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: 安装依赖 run: | diff --git a/.github/workflows/build-on-Linux-x64.yml b/.github/workflows/build-on-Linux-x64.yml index 27cbc83..038e20a 100644 --- a/.github/workflows/build-on-Linux-x64.yml +++ b/.github/workflows/build-on-Linux-x64.yml @@ -20,7 +20,7 @@ jobs: steps: - name: 检出代码 - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: 构建 run: | diff --git a/.github/workflows/build-on-Windows.yml b/.github/workflows/build-on-Windows.yml index c009e28..28bc12e 100644 --- a/.github/workflows/build-on-Windows.yml +++ b/.github/workflows/build-on-Windows.yml @@ -24,7 +24,7 @@ jobs: steps: - name: 检出代码 - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: 安装 GCC uses: msys2/setup-msys2@v2 diff --git a/.github/workflows/build-on-macOS.yml b/.github/workflows/build-on-macOS.yml index a86ea82..a2ae76a 100644 --- a/.github/workflows/build-on-macOS.yml +++ b/.github/workflows/build-on-macOS.yml @@ -20,7 +20,7 @@ jobs: steps: - name: 检出代码 - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: 检查编译器版本 run: | @@ -53,7 +53,7 @@ jobs: steps: - name: 检出代码 - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: 检查编译器版本 run: | diff --git a/.github/workflows/pkg-deb.yml b/.github/workflows/pkg-deb.yml index d3d077c..80a2501 100644 --- a/.github/workflows/pkg-deb.yml +++ b/.github/workflows/pkg-deb.yml @@ -30,7 +30,7 @@ jobs: steps: - name: 检出代码 - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: ref: gh-build From 6315f44950814b8dfed838e87c46087ad358dcbb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 17 Aug 2025 09:33:54 +0800 Subject: [PATCH 002/103] Bump actions/download-artifact from 4 to 5 (#253) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4 to 5. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/pkg-deb.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pkg-deb.yml b/.github/workflows/pkg-deb.yml index 80a2501..162ac85 100644 --- a/.github/workflows/pkg-deb.yml +++ b/.github/workflows/pkg-deb.yml @@ -156,7 +156,7 @@ jobs: steps: - name: Download all artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v5 with: pattern: chsrc-deb-files merge-multiple: true From a31bfe03776c9fb4cda6f41a56efd3541bddd11d Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Sun, 17 Aug 2025 10:59:50 +0800 Subject: [PATCH 003/103] Update README --- README.md | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 26b4cb5..13dba85 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ! Contributors : Mikachu2333 ! | ! Created On : <2023-12-28> - ! Last Modified : <2025-08-11> + ! Last Modified : <2025-08-17> ! ---------------------------------------------------------- -->
@@ -16,7 +16,7 @@ 全平台通用换源工具与框架 `chsrc`,**目标支持 Linux, Windows (native, MSYS2, Cygwin), macOS, BSD, Android 等尽可能多的操作系统环境,龙芯、飞腾、RISC-V 等尽可能多的 CPU**。 -我们使用 **C11** 来完成上述目标。我们并不使用 Python 或 JS 等解释语言,因为一个简单的换源工具,不应该强行塞给用户一个庞大的解释器和数十、数百 MB 其他文件。 +我们使用 **C11** 来完成上述目标。我们并不使用 Python 或 JavaScript 等解释语言,因为一个简单的换源工具,不应该强行塞给用户一个庞大的解释器和数十、数百 MB 其他文件。 本软件为**自由软件**,SDPX 软件许可证为 `GPL-3.0-or-later and MIT` @@ -39,6 +39,20 @@ +## ❤️ 致所有的朋友们 + +2025年8月11日,我因通宵重构本项目代码而被送去抢救([#252](https://github.com/RubyMetric/chsrc/issues/252),[突发!换源工具 chsrc 作者在重构过程中被送去 120 抢救](https://v2ex.com/t/1151802))。大家给予的关心和帮助让我非常非常感动!在此,我衷心感谢每一位朋友!**无论是开源还是闭源,无论是否为职业程序员,我们其实都是一群使用软件、热心互助、充满友爱的人,这是一个温暖的大家庭**。 + +我为 `chsrc` 采用 GPL 协议,怀着殷切的期望:**希望能够营造像 Richard Stallman 在创建 GNU 项目之前,在 MIT 那样的氛围——写自己用得上的软件,与大家一起开发、维护,简单纯粹,无关商业利益。就像一支球队,因为共同的目标而努力**。 + +这次经历让我更加深刻地体会到:开源,是一种把大家联系在一起的方式,**它让友情、互助和协作成为可能,也让我们在共同的目标中建立起长期的纽带**。 + +最后,希望大家能够**时刻关注**自己的身体,**你可以随时 `chsrc` `chown` `chgrp` `chmod` 无限次,但是无法 `chbody`**! + +
+ + + ## 🤝 协作与贡献 > [!TIP] @@ -47,10 +61,9 @@ --- > [!NOTE] -> 这是你可以参与的第一个现实世界中有用的C语言项目,[用 VS Code 一分钟内上手编译、运行、测试 chsrc](./doc/01-开发与构建.md) +> 这也许是你可以参与的第一个现实世界中有用的C语言项目,[用 VS Code 一分钟内上手编译、运行、测试 chsrc](./doc/01-开发与构建.md) > > 欢迎对 GitHub、Gitee 协作不熟悉的人以此为契机学习参与贡献, 欢迎任何编程初学者。[从开发到提交PR,我们覆盖全流程文档](./doc/) -,作者可提供一定的 [贡献指导](https://github.com/RubyMetric/chsrc/discussions/50) --- > [!IMPORTANT] From 2e3dc9349921a178e43e90f3e3d5300781c0c2a7 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Sun, 17 Aug 2025 11:02:26 +0800 Subject: [PATCH 004/103] Update doc --- doc/10-如何编写recipe.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/10-如何编写recipe.md b/doc/10-如何编写recipe.md index e2915c8..518af2e 100644 --- a/doc/10-如何编写recipe.md +++ b/doc/10-如何编写recipe.md @@ -7,7 +7,7 @@ ! Contributors : Nul None ! | ! Created On : <2024-08-19> - ! Last Modified : <2025-08-11> + ! Last Modified : <2025-08-17> ! ---------------------------------------------------------- --> # Write A Recipe Even If You Don't Know C @@ -52,6 +52,8 @@ - `source`: 该 `target` 所能换的具体的源,由 `mirror` 提供服务,往往一个 `mirror` 会提供许多 `source` - `recipe`: 是为一个 `target` 定义的具体换源方法,请参考 `src` 目录中的 `recipe` 目录 +- `chef DSL`:是 `chef Domain Specific Language` 的简写,这是一组以 `chef_` 开头的函数,用来定义维护者信息、可用源等元信息 + - **换源链接**: 指镜像站所提供的某一个具体的换源使用的URL - **测速链接**: 用来测速的URL,与 "换源链接" 不同,可分为 **精准测速** 和 **模糊测速** @@ -81,7 +83,7 @@ 该函数将填充 target 所有的必要信息,包括维护信息、换源信息 -7. [设置/修改 "换源 URL" 和 "测速 URL" (how?)](./11-如何设置换源链接与测速链接.md) +7. [设置/修改 "换源链接" 和 "测速链接" (how?)](./11-如何设置换源链接与测速链接.md) 8. 按需实现 `_setsrc()` `_getsrc()` `_resetsrc()`, 可以使用这些函数: From 41c449f4acb5c1af8955ee2028c78229e57fb62a Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Sun, 17 Aug 2025 11:09:51 +0800 Subject: [PATCH 005/103] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 13dba85..8aa838d 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ 2025年8月11日,我因通宵重构本项目代码而被送去抢救([#252](https://github.com/RubyMetric/chsrc/issues/252),[突发!换源工具 chsrc 作者在重构过程中被送去 120 抢救](https://v2ex.com/t/1151802))。大家给予的关心和帮助让我非常非常感动!在此,我衷心感谢每一位朋友!**无论是开源还是闭源,无论是否为职业程序员,我们其实都是一群使用软件、热心互助、充满友爱的人,这是一个温暖的大家庭**。 -我为 `chsrc` 采用 GPL 协议,怀着殷切的期望:**希望能够营造像 Richard Stallman 在创建 GNU 项目之前,在 MIT 那样的氛围——写自己用得上的软件,与大家一起开发、维护,简单纯粹,无关商业利益。就像一支球队,因为共同的目标而努力**。 +我为 `chsrc` 采用 GPL 协议,怀着殷切的期望:**希望能够营造像 Richard Stallman 在创建 GNU 项目之前,在 MIT 那样的氛围——写自己用得上的软件,与大家一起开发、维护,简单纯粹,无关商业利益。就像小区、校园自发组建的足球篮球队,从一次偶然的加入,逐渐成长为互相支持的伙伴**。 这次经历让我更加深刻地体会到:开源,是一种把大家联系在一起的方式,**它让友情、互助和协作成为可能,也让我们在共同的目标中建立起长期的纽带**。 From a3cf4fcc9995b66bc97ee4c6c2b9a76c0a811e99 Mon Sep 17 00:00:00 2001 From: Mikachu2333 Date: Sun, 17 Aug 2025 16:15:52 +0800 Subject: [PATCH 006/103] fix pwsh path error (#250) * add version * improve test actions * use XY_On_Windows --------- Co-authored-by: mikachu2333 --- .github/workflows/PR-test.yml | 22 ++++++++++----- lib/xy.h | 51 +++++++++++++++++++++++++++++------ test/xy.c | 9 ++++--- 3 files changed, 65 insertions(+), 17 deletions(-) diff --git a/.github/workflows/PR-test.yml b/.github/workflows/PR-test.yml index 644f528..de72e84 100644 --- a/.github/workflows/PR-test.yml +++ b/.github/workflows/PR-test.yml @@ -5,7 +5,7 @@ # | Mikachu2333 # | # Created On : <2025-06-19> -# Last Modified : <2025-08-07> +# Last Modified : <2025-08-17> # # Test PR # --------------------------------------------------------------- @@ -14,11 +14,15 @@ name: 测试PR on: pull_request: - types: [opened, - synchronize, # 后续提交 - ready_for_review, # draft PR 转为正式 PR - review_requested, - reopened] + # 仅在开 pr、草稿转正式、手动要求 review、reopen的时候运行测试 + types: [ + opened, + # 因 synchronize 将导致 pr 的构建过于频繁而禁用 + # synchronize, # 在 pr 者 push commit 时每次构建 + ready_for_review, # draft PR 转为正式 PR + review_requested, + reopened, + ] paths: - "src/**" - "lib/**" @@ -50,6 +54,12 @@ jobs: - name: 检出代码 uses: actions/checkout@v5 + - name: 创建测试文件 + shell: powershell + run: | + New-Item -Path "$env:USERPROFILE\Documents\Powershell\Microsoft.PowerShell_profile.ps1" -ItemType File -Force + New-Item -Path "$env:USERPROFILE\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" -ItemType File -Force + - name: 安装依赖 run: | choco install just diff --git a/lib/xy.h b/lib/xy.h index 50915bf..771489f 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -9,7 +9,7 @@ * | Mikachu2333 * | * Created On : <2023-08-28> - * Last Modified : <2025-08-09> + * Last Modified : <2025-08-17> * * xy: 襄阳、咸阳 * Corss-Platform C11 utilities for CLI applications in mixed @@ -19,7 +19,7 @@ #ifndef XY_H #define XY_H -#define _XY_Version "v0.1.5.5-2025/08/09" +#define _XY_Version "v0.1.5.5-2025/08/17" #define _XY_Maintain_URL "https://github.com/RubyMetric/chsrc/blob/dev/lib/xy.h" #define _XY_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc/blob/dev/lib/xy.h" @@ -66,6 +66,7 @@ bool xy_enable_color = true; #define xy_on_bsd false #define xy_os_devnull "nul" #include + #include #define xy_useutf8() SetConsoleOutputCP (65001) #elif defined(__linux__) || defined(__linux) @@ -784,21 +785,55 @@ _xy_os_home () return home; } + +static char * +_xy_win_documents () +{ +#ifdef XY_On_Windows + char documents_path[MAX_PATH]; + HRESULT result = SHGetFolderPathA (NULL, CSIDL_MYDOCUMENTS, NULL, + SHGFP_TYPE_CURRENT, documents_path); + + if (SUCCEEDED (result)) + return xy_strdup (documents_path); + + return xy_2strjoin (xy_os_home, "\\Documents"); +#else + return NULL; +#endif +} + #define xy_win_powershell_profile _xy_win_powershell_profile () #define xy_win_powershellv5_profile _xy_win_powershellv5_profile () + +// 更新 PowerShell 配置文件路径函数 static char * _xy_win_powershell_profile () { - return xy_2strjoin ( - xy_os_home, "\\Documents\\PowerShell\\Microsoft.PowerShell_profile.ps1"); + if (xy_on_windows) + { + char *documents_dir = _xy_win_documents (); + char *profile_path = xy_2strjoin (documents_dir, "\\PowerShell\\Microsoft.PowerShell_profile.ps1"); + free (documents_dir); + return profile_path; + } + else + return NULL; } -char * + +static char * _xy_win_powershellv5_profile () { - return xy_2strjoin ( - xy_os_home, - "\\Documents\\WindowsPowerShell\\Microsoft.PowerShell_profile.ps1"); + if (xy_on_windows) + { + char *documents_dir = _xy_win_documents (); + char *profile_path = xy_2strjoin (documents_dir, "\\WindowsPowerShell\\Microsoft.PowerShell_profile.ps1"); + free (documents_dir); + return profile_path; + } + else + return NULL; } #define xy_zshrc "~/.zshrc" diff --git a/test/xy.c b/test/xy.c index 7c64414..325e9b5 100644 --- a/test/xy.c +++ b/test/xy.c @@ -2,11 +2,12 @@ * SPDX-License-Identifier: MIT * ------------------------------------------------------------- * File Name : xy.c - * File Authors : Aoran Zeng - * Contributors : Nil Null + * File Authors : Aoran Zeng + * Contributors : Nil Null + * | Mikachu2333 * | * Created On : <2023-08-30> - * Last Modified : <2025-08-08> + * Last Modified : <2025-08-11> * * Test xy.h * ------------------------------------------------------------*/ @@ -97,6 +98,8 @@ main (int argc, char const *argv[]) assert (xy_dir_exist ("~")); if (xy_on_windows) { + say (xy_win_powershell_profile); + say (xy_win_powershellv5_profile); assert (xy_file_exist (xy_win_powershell_profile)); assert (true == xy_file_exist (xy_win_powershellv5_profile)); assert (xy_dir_exist ("C:\\Users")); From e2146a57095df88bb29a29b96f0ce83bf98b300d Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Sun, 17 Aug 2025 17:17:56 +0800 Subject: [PATCH 007/103] Update code style --- doc/03-为什么拒绝使用代码格式化工具.md | 46 ++++++++++++++++++-------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/doc/03-为什么拒绝使用代码格式化工具.md b/doc/03-为什么拒绝使用代码格式化工具.md index f9487bf..c781a98 100644 --- a/doc/03-为什么拒绝使用代码格式化工具.md +++ b/doc/03-为什么拒绝使用代码格式化工具.md @@ -6,7 +6,7 @@ ! Doc Authors : Aoran Zeng ! Contributors : Nul None ! Created On : <2025-08-10> - ! Last Modified : <2025-08-11> + ! Last Modified : <2025-08-17> ! ---------------------------------------------------------- --> # chsrc 代码风格 @@ -19,16 +19,22 @@ Ruby 的语法优美性在编程行业中具有标杆地位。Matz(松本行
+ + ## 为什么我们坚持不使用代码格式化工具 代码格式化工具(code formatter)在多人协作的代码仓库中确实有其价值,**参与的人越多,统一格式的需求越迫切**。然而,`chsrc` 项目经过深思熟虑后,拒绝使用代码格式化工具。让我来说明这一决定背后的深层原因。 -像 `Prettier` 这样的工具表面上带来了统一性,但其代价是什么?**它是极度专制的(opiniated)**,这意味着为了获得表面的一致性,我们必须**完全交出代码审美的自主权**。今天我们大部分人使用 `Prettier`,**并非出于真心的认同,而是因为整个前端生态圈的集体胁迫——不用就意味着被边缘化**。 +像 `Prettier` 这样的工具表面上带来了统一性,但其代价是什么?**它是极度专制的(opiniated)**,这意味着为了获得表面的一致性,我们必须**完全交出代码审美的自主权**。今天我们大部分人使用 `Prettier`,**并非出于真心的认同,而是因为整个前端生态圈的集体胁迫——不用就意味着被边缘化**。每一个有追求的程序员都应该保留**对代码美学的最后决定权,格式化工具的便利性不应该以牺牲美观性和可维护性为代价**。 这种现象的本质令人深思:**少数 `Prettier` 维护者的个人偏好,竟然决定了全球数百万开发者的代码美学标准。这显然是一种技术独裁,坚决拒绝向格式化工具的霸权低头**。 C语言的格式化工具通常选择 `clang-format`,它的配置选项十分丰富,比 `Prettier` 要理性得多。然而,即便如此,**其配置的复杂性和局限性仍然无法满足 chsrc 对代码美学的严苛要求**。如果你是一位 `clang-format` 的配置专家,我们诚挚邀请您告诉我们如何优雅地处理以下代码场景,**也许这能改变我的立场**。 +
+ + + ### 挑战案例 以下是我认为自动格式化工具很难完美处理的代码场景: @@ -64,15 +70,7 @@ if (!matched) matched = iterate_menu (chsrc_wr_menu, input, &target_tmp);
-## 我们的立场 -**代码不仅仅是给机器执行的指令,更是团队协作和项目传承的重要载体**。 - -每一个有追求的程序员都应该保留对代码美学的最后决定权。格式化工具的便利性不应该以牺牲创造力和个性为代价。在 `chsrc` 项目中,我们选择用更多的时间和精力来精心设计每一行代码。正如 Ruby 社区所倡导的那样,**程序员的幸福感不应该被自动化工具的专制所剥夺。我们追求的不是表面的一致性,而是深层次的代码质量和表达力。这不是对工具的盲目排斥,而是对程序员自主性的坚持。这不是标新立异的固执,而是对代码质量的不妥协。** - -如果你也认同 **代码应该为人类而写** 的理念,欢迎加入我们,一起创造真正优质的代码。 - -
## C语言代码风格 @@ -80,15 +78,37 @@ if (!matched) matched = iterate_menu (chsrc_wr_menu, input, &target_tmp); - 类型名: `PascalCase_t` -- 函数调用时,函数名和`()`之间应当保持一个空格。但是当函数参数为0或1时,不保持该空格 - - 函数定义时,函数名和`()`之间始终保持一个空格 +- 函数和函数定义之间保持**2个空行**,若一系列函数和一系列函数存在主题性区别,**可用3个空行** + +- 函数调用时,函数名和`()`之间应当保持一个空格 + + 例外: 当函数参数为0或1时不用保持该空格。 + + 但若该函数参数过长如很长的字符串,又或嵌套了函数,我们仍然保持一个空格。 + +```c +// 一般函数调用都空格,因为这是 GNU 风格最显著的特征之一 +func (1, 2); + +// 这两种情况不用保持空格,因为没有必要 +br(); +red("string"); + +// 但如果有函数嵌套,即使参数只有1个,外部函数还是要保持空格,这样清晰地多 +func1 (func2("string")); +// 如果参数过长,即使参数只有1个,也应该保持空格 +red ("loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong string"); +``` +
+ + ## 其他语言代码风格 -我们秉承 **入乡随俗、尊重传统** 的原则,尊重每种语言社区的既定传统。比如,`YAML` 使用2个空格的优雅,`JSON`使用4个空格的规整,`Perl` 使用 Larry Wall 钟爱的4个空格传统。 +我们秉承 **入乡随俗、尊重传统** 的原则,尊重每种语言社区的既定传统。比如,`YAML` 使用2个空格,`JSON`使用4个空格,`Perl` 使用 Larry Wall 钟爱的4个空格。 我们使用 `.editorconfig` 来确保这些格式的应用。 From 97f307c93c0d2b53eaab32c475c31dc67750cca8 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Sun, 17 Aug 2025 17:23:07 +0800 Subject: [PATCH 008/103] Add `Markdown` writing style --- doc/03-为什么拒绝使用代码格式化工具.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/03-为什么拒绝使用代码格式化工具.md b/doc/03-为什么拒绝使用代码格式化工具.md index c781a98..7dfad59 100644 --- a/doc/03-为什么拒绝使用代码格式化工具.md +++ b/doc/03-为什么拒绝使用代码格式化工具.md @@ -92,11 +92,11 @@ if (!matched) matched = iterate_menu (chsrc_wr_menu, input, &target_tmp); // 一般函数调用都空格,因为这是 GNU 风格最显著的特征之一 func (1, 2); -// 这两种情况不用保持空格,因为没有必要 +// 当函数参数为0或1时不用保持空格,因为能更紧凑一些 br(); red("string"); -// 但如果有函数嵌套,即使参数只有1个,外部函数还是要保持空格,这样清晰地多 +// 但如果有函数嵌套,即使参数只有1个,外部函数还是要保持空格,这样清晰得多 func1 (func2("string")); // 如果参数过长,即使参数只有1个,也应该保持空格 red ("loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong string"); @@ -106,6 +106,18 @@ red ("loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong stri +## Markdown 写作风格 + +维护者很多时候不是从渲染好的界面来看 Markdown 文件的,而是阅读 Markdown 源文件,所以 Markdown 在源文件层面也要易读。 + +我们保持每个主题之间 **1个`
` + 3个空行** 的简单风格。 + +拒绝使用 VS Code 的 `markdownlint` 插件,**因为它总是用它狭隘的标准给我们增加了巨多的黄色下划线**。 + +
+ + + ## 其他语言代码风格 我们秉承 **入乡随俗、尊重传统** 的原则,尊重每种语言社区的既定传统。比如,`YAML` 使用2个空格,`JSON`使用4个空格,`Perl` 使用 Larry Wall 钟爱的4个空格。 From 5f77b80a4b2ed07977cae9e1a8a396b625487b92 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Sun, 17 Aug 2025 17:38:50 +0800 Subject: [PATCH 009/103] Ignore the annoying changes to `.vscode/settings.json` --- tool/git-ignore-vscode-settings.ps1 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tool/git-ignore-vscode-settings.ps1 diff --git a/tool/git-ignore-vscode-settings.ps1 b/tool/git-ignore-vscode-settings.ps1 new file mode 100644 index 0000000..c53f584 --- /dev/null +++ b/tool/git-ignore-vscode-settings.ps1 @@ -0,0 +1,17 @@ +# --------------------------------------------------------------- +# SPDX-License-Identifier: GPL-3.0-or-later +# --------------------------------------------------------------- +# File Name : git-ignore-vscode-settings.ps1 +# File Authors : Aoran Zeng +# Created On : <2025-08-17> +# Last Modified : <2025-08-17> +# +# VS Code 的某些操作/插件会频繁地修改我们的 .vscode/settings.json +# 文件,非常非常烦人,但是该文件又应该被加入仓库,所以我们使用以下 +# 命令来忽略它在本地的变化 +# --------------------------------------------------------------- + +git update-index --skip-worktree .\.vscode\settings.json + +# 恢复方法是: +# git update-index --no-skip-worktree .\.vscode\settings.json From 0a91a9bdd5f6cd0c79f568b4b453cb2b905ee22a Mon Sep 17 00:00:00 2001 From: Mikachu2333 Date: Sun, 17 Aug 2025 19:28:37 +0800 Subject: [PATCH 010/103] test --- lib/xy.h | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index 771489f..dd39274 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -912,26 +912,19 @@ xy_normalize_path (const char *path) { char *new = xy_str_strip (path); // 防止开发者多写了空白符 - if (xy_on_windows) + if (xy_str_start_with (new, "~")) { - if (xy_str_start_with (new, "~/")) - { - // 或 %USERPROFILE% - new = xy_strjoin (3, xy_os_home, "\\", - xy_str_delete_prefix (new, "~/")); - } - new = xy_str_gsub (new, "/", "\\"); - } - else - { - if (xy_str_start_with (new, "~/")) - { - new = xy_strjoin (3, xy_os_home, "/", - xy_str_delete_prefix (new, "~/")); - } + new = xy_strjoin (3, xy_os_home, "/", + xy_str_delete_prefix (new, "~")); } - return new; + new = xy_str_gsub (new, "\\", "/"); + new = xy_str_gsub (new, "//", "/"); + + if (xy_on_windows) + return xy_str_gsub (new, "/", "\\"); + else + return new; } static char * From 07685390b0af45ff4df0fea9b0c86a59690b0aa3 Mon Sep 17 00:00:00 2001 From: Mikachu2333 Date: Sun, 17 Aug 2025 19:52:04 +0800 Subject: [PATCH 011/103] fix parent --- lib/xy.h | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index dd39274..9848aec 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -927,32 +927,31 @@ xy_normalize_path (const char *path) return new; } +/** + * @note 总是返回不含末尾斜杠的父目录路径 + */ static char * xy_parent_dir (const char *path) { char *dir = xy_normalize_path (path); + dir = xy_str_gsub (dir, "\\", "/"); + if (xy_str_end_with (dir, "/")) + dir = xy_str_delete_suffix (dir, "/"); + char *last = NULL; + + last = strrchr (dir, '/'); + if (!last) + { + /* current dir */ + return "."; + } + *last = '\0'; + if (xy_on_windows) - { - last = strrchr (dir, '\\'); - if (!last) - { - /* current dir */ - return "."; - } - *last = '\0'; - } + return xy_str_gsub (dir, "/", "\\"); else - { - last = strrchr (dir, '/'); - if (!last) - { - /* current dir */ - return "."; - } - *last = '\0'; - } - return dir; + return dir; } #endif From 4d813893e91a463e577ccf7f5d1bd6ed3aaf8289 Mon Sep 17 00:00:00 2001 From: Mikachu2333 Date: Sun, 17 Aug 2025 19:52:07 +0800 Subject: [PATCH 012/103] add tests --- test/xy.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/xy.c b/test/xy.c index 325e9b5..856d38a 100644 --- a/test/xy.c +++ b/test/xy.c @@ -103,6 +103,13 @@ main (int argc, char const *argv[]) assert (xy_file_exist (xy_win_powershell_profile)); assert (true == xy_file_exist (xy_win_powershellv5_profile)); assert (xy_dir_exist ("C:\\Users")); + assert_str (xy_normalize_path ("C:\\a bc\\def\\"), "C:\\a bc\\def\\"); + assert_str (xy_normalize_path ("a/b c/d"), "a\\b c\\d"); + assert_str (xy_normalize_path ("a/b c/d/"), "a\\b c\\d\\"); + assert_str (xy_parent_dir ("a/b c/d"), "a\\b c"); + assert_str (xy_parent_dir ("a/b c\\d/"), "a\\b c"); + assert_str (xy_parent_dir (xy_normalize_path ("~/")), "C:\\Users"); + assert_str (xy_parent_dir (xy_normalize_path ("~")), "C:\\Users"); } else { @@ -115,6 +122,8 @@ main (int argc, char const *argv[]) assert (xy_file_exist (xy_bashrc)); } assert (xy_dir_exist ("/etc")); + assert_str (xy_normalize_path ("a\\b c\\d"), "a/b c/d"); + assert_str (xy_normalize_path ("a\\b c\\d\\"), "a/b c/d/"); } println (xy_normalize_path (" \n ~/haha/test/123 \n\r ")); From 0d19ee249f779ce6ec95b071eaca2ee2b5606ee6 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Mon, 18 Aug 2025 19:23:16 +0800 Subject: [PATCH 013/103] Fix `xy_normalize_path()` --- lib/xy.h | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index 9848aec..9f97bfd 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -9,7 +9,7 @@ * | Mikachu2333 * | * Created On : <2023-08-28> - * Last Modified : <2025-08-17> + * Last Modified : <2025-08-18> * * xy: 襄阳、咸阳 * Corss-Platform C11 utilities for CLI applications in mixed @@ -19,7 +19,7 @@ #ifndef XY_H #define XY_H -#define _XY_Version "v0.1.5.5-2025/08/17" +#define _XY_Version "v0.1.6.0-2025/08/18" #define _XY_Maintain_URL "https://github.com/RubyMetric/chsrc/blob/dev/lib/xy.h" #define _XY_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc/blob/dev/lib/xy.h" @@ -904,37 +904,47 @@ xy_dir_exist (const char *path) } /** - * 1. 删除路径左右两边多出来的空白符 - * 2. 将 ~/ 转换为绝对路径 + * @brief 规范化路径 + * + * @details + * 1. 删除路径左右两边多出来的空白符 + * - 防止通过间接方式得到的路径包含了空白字符 (如 grep 出来的结果) + * - 防止维护者多写了空白字符 + * 2. 将 ~ 转换为绝对路径 + * 3. 在Windows上,使用标准的 \ 作为路径分隔符 */ static char * xy_normalize_path (const char *path) { - char *new = xy_str_strip (path); // 防止开发者多写了空白符 + char *new = xy_str_strip (path); if (xy_str_start_with (new, "~")) { - new = xy_strjoin (3, xy_os_home, "/", - xy_str_delete_prefix (new, "~")); + new = xy_2strjoin (xy_os_home, xy_str_delete_prefix (new, "~")); } - new = xy_str_gsub (new, "\\", "/"); - new = xy_str_gsub (new, "//", "/"); - if (xy_on_windows) return xy_str_gsub (new, "/", "\\"); else return new; } + /** - * @note 总是返回不含末尾斜杠的父目录路径 + * @brief 返回一个路径的父目录名 + * + * @note + * - 返回的是真正的 "目录名" (就像文件名一样),而不是 "路径",所以一定是不含末尾斜杠的 + * - 在Windows上,使用标准的 \ 作为路径分隔符 */ static char * xy_parent_dir (const char *path) { char *dir = xy_normalize_path (path); + + /* 不管是否为Windows,全部统一使用 / 作为路径分隔符,方便后续处理 */ dir = xy_str_gsub (dir, "\\", "/"); + if (xy_str_end_with (dir, "/")) dir = xy_str_delete_suffix (dir, "/"); @@ -943,11 +953,12 @@ xy_parent_dir (const char *path) last = strrchr (dir, '/'); if (!last) { - /* current dir */ + /* 路径中没有一个 / 是很奇怪的,我们直接返回 . 作为当前目录 */ return "."; } *last = '\0'; + /* Windows上重新使用 \ 作为路径分隔符 */ if (xy_on_windows) return xy_str_gsub (dir, "/", "\\"); else From 555eb91d35e41d89f886fc614fc827d9c0427fcb Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Mon, 18 Aug 2025 19:23:32 +0800 Subject: [PATCH 014/103] Fix and add test --- test/xy.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/xy.c b/test/xy.c index 856d38a..3abf3fc 100644 --- a/test/xy.c +++ b/test/xy.c @@ -7,7 +7,7 @@ * | Mikachu2333 * | * Created On : <2023-08-30> - * Last Modified : <2025-08-11> + * Last Modified : <2025-08-18> * * Test xy.h * ------------------------------------------------------------*/ @@ -98,18 +98,23 @@ main (int argc, char const *argv[]) assert (xy_dir_exist ("~")); if (xy_on_windows) { + say (xy_normalize_path ("~")); + say (xy_normalize_path ("~/")); + // xy_parent_dir() 得到的结果一定是不包含尾斜杠的目录名 + assert_str (xy_parent_dir (xy_normalize_path ("~")), "C:\\Users"); + assert_str (xy_parent_dir (xy_normalize_path ("~/")), "C:\\Users"); + assert (xy_dir_exist ("C:\\Users")); + say (xy_win_powershell_profile); say (xy_win_powershellv5_profile); assert (xy_file_exist (xy_win_powershell_profile)); assert (true == xy_file_exist (xy_win_powershellv5_profile)); - assert (xy_dir_exist ("C:\\Users")); + assert_str (xy_normalize_path ("C:\\a bc\\def\\"), "C:\\a bc\\def\\"); assert_str (xy_normalize_path ("a/b c/d"), "a\\b c\\d"); assert_str (xy_normalize_path ("a/b c/d/"), "a\\b c\\d\\"); assert_str (xy_parent_dir ("a/b c/d"), "a\\b c"); assert_str (xy_parent_dir ("a/b c\\d/"), "a\\b c"); - assert_str (xy_parent_dir (xy_normalize_path ("~/")), "C:\\Users"); - assert_str (xy_parent_dir (xy_normalize_path ("~")), "C:\\Users"); } else { From e98361f33be8b5bf4ed244b16eb28d665a00a5c8 Mon Sep 17 00:00:00 2001 From: Mikachu2333 Date: Mon, 18 Aug 2025 19:49:48 +0800 Subject: [PATCH 015/103] xy.h comments --- lib/xy.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 10 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index 9f97bfd..87fdf01 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -19,7 +19,7 @@ #ifndef XY_H #define XY_H -#define _XY_Version "v0.1.6.0-2025/08/18" +#define _XY_Version "v0.1.6.1-2025/08/18" #define _XY_Maintain_URL "https://github.com/RubyMetric/chsrc/blob/dev/lib/xy.h" #define _XY_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc/blob/dev/lib/xy.h" @@ -165,7 +165,13 @@ xy_malloc0 (size_t size) ******************************************************/ /** - * 将str中所有的pat字符串替换成replace,返回一个全新的字符串 + * @brief 将 str 中所有的 pat 字符串替换成 replace,返回一个全新的字符串;也可用作删除、缩小、扩张 + * + * @param str 原字符串 + * @param pat 要替换的字符串 + * @param replace 替换成的字符串 + * + * @return 替换后的新字符串 */ static char * xy_str_gsub (const char *str, const char *pat, const char *replace) @@ -231,6 +237,15 @@ xy_2strjoin (const char *str1, const char *str2) return ret; } + +/** + * @brief 将多个字符串连接成一个字符串 + * + * @param count 连接的字符串数量 + * @param ... 连接的字符串 + * + * @return 拼接的新字符串 + */ static char * xy_strjoin (unsigned int count, ...) { @@ -285,6 +300,14 @@ xy_strjoin (unsigned int count, ...) return ret; } + +/** + * @brief 复制一个字符串,返回复制的新字符串 + * + * @param str 要复制的字符串 + * + * @return 复制的新字符串 + */ static char * xy_strdup (const char *str) { @@ -684,14 +707,16 @@ _xy_log_brkt (int level, const char *prompt1, const char *prompt2, const char *c /****************************************************** * System ******************************************************/ + /** - * 执行cmd,返回某行输出结果,并对已经遍历过的行执行iter_func + * @brief 执行cmd,返回某行输出结果,并对已经遍历过的行执行iter_func * * @param cmd 要执行的命令 * @param n 指定命令执行输出的结果行中的某一行,0 表示最后一行,n (n>0) 表示第n行 - * 该函数会返回这一行的内容 * @param iter_func 对遍历时经过的行的内容,进行函数调用 * + * @return 该函数会返回 参数 n 指定的该行的内容 + * * @note 返回的字符串最后面一般有换行符号 * * 由于目标行会被返回出来,所以 iter_func() 并不执行目标行,只会执行遍历过的行 @@ -745,8 +770,7 @@ xy_run (const char *cmd, unsigned long n) ******************************************************/ /** - * 该函数同 just 中的 os_family(),只区分 windows, unix - * + * @note 该函数同 just 中的 os_family(),只区分 windows, unix * @return 返回 "windows" 或 "unix" */ #define xy_os_family _xy_os_family () @@ -761,7 +785,7 @@ _xy_os_family () /** - * 该函数返回所在 os family 的对应字符串 + * @brief 该函数返回所在 os family 的对应字符串 */ static const char * xy_os_depend_str (const char *str_for_win, const char *str_for_unix) @@ -773,6 +797,12 @@ xy_os_depend_str (const char *str_for_win, const char *str_for_unix) } +/** + * @brief 返回当前操作系统的 HOME 目录 + * + * @note Windows 上返回 %USERPROFILE%,Linux 等返回 $HOME + * @warning Windows 上要警惕 Documents 等目录被移动位置的情况,避免使用本函数的 HOME 路径直接拼接 Documents,应参考 _xy_win_documents() 的实现 + */ #define xy_os_home _xy_os_home () static char * _xy_os_home () @@ -786,6 +816,12 @@ _xy_os_home () } +/** + * @brief 返回 Windows 上的 Documents 目录 + * + * @note 警告,不可使用 HOME 目录直接拼接,若用户移动了 Documents,将导致错误 + * @warning 非 Windows 返回 NULL + */ static char * _xy_win_documents () { @@ -806,7 +842,11 @@ _xy_win_documents () #define xy_win_powershell_profile _xy_win_powershell_profile () #define xy_win_powershellv5_profile _xy_win_powershellv5_profile () -// 更新 PowerShell 配置文件路径函数 +/** + * @brief 返回 Windows 上 pwsh (>=v5) 的配置文件路径 + * + * @warning 非 Windows 返回 NULL + */ static char * _xy_win_powershell_profile () { @@ -822,6 +862,11 @@ _xy_win_powershell_profile () } +/** + * @brief 返回 Windows 上自带的 powershell (v5) 的配置文件路径 + * + * @warning 非 Windows 返回 NULL + */ static char * _xy_win_powershellv5_profile () { @@ -856,8 +901,8 @@ xy_file_exist (const char *path) } /** - * @note xy_file_exist() 和 xy_dir_exist() 两个函数在所有平台默认都支持使用 '~', - * 但实现中都没有调用 xy_normalize_path(),以防万一,调用前可能需要用户手动调用它 + * @note `xy_file_exist()` 和 `xy_dir_exist()` 两个函数在所有平台默认都支持使用 '~', + * 但实现中都没有调用 `xy_normalize_path()`,以防万一,调用前可能需要用户手动调用它 */ static bool xy_dir_exist (const char *path) @@ -923,6 +968,11 @@ xy_normalize_path (const char *path) new = xy_2strjoin (xy_os_home, xy_str_delete_prefix (new, "~")); } + // 在特殊情况下上面的替换最终可能导致形如 `/foo//bar/` 之类的东西 + // 建议进行去重处理以防万一 + //new = xy_str_gsub (new, "\\", "/"); + //new = xy_str_gsub (new, "//", "/"); + if (xy_on_windows) return xy_str_gsub (new, "/", "\\"); else From 5e4bf57d45ef4a247d81fad5a4f7caac0b4e09bf Mon Sep 17 00:00:00 2001 From: Mikachu2333 Date: Mon, 18 Aug 2025 19:50:02 +0800 Subject: [PATCH 016/103] template comments --- src/recipe/recipe-template.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/recipe/recipe-template.c b/src/recipe/recipe-template.c index 8975e38..5ee5614 100644 --- a/src/recipe/recipe-template.c +++ b/src/recipe/recipe-template.c @@ -59,28 +59,28 @@ void __prelude (void) { use_this(_); - chef_allow_gsr(_); - // chef_allow_s(_); + chef_allow_gsr(_); //代表支持 Get Set Reset 三种操作 + // chef_allow_s(_); //以此类推 // chef_allow_gs(_); // chef_allow_sr(_); - chef_set_created_on (this, "2024-08-09"); - chef_set_last_updated (this, "2025-08-12"); - chef_set_sources_last_updated (this, "2025-08-11"); + chef_set_created_on (this, "2024-08-09"); //文件创建日期 + chef_set_last_updated (this, "2025-08-12"); //文件最后一次更新日期 + chef_set_sources_last_updated (this, "2025-08-11"); //镜像站点最后一次更新日期 - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); + chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); //作者 chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, + chef_set_cooks (this, 0); //想一直为它贡献和更新?将自己加在这里! + chef_set_contributors (this, 1, //为它做了贡献?将自己的信息加在这里! "Nil Null", "nil@null.org"); chef_allow_local_mode (this, PartiallyCan, "具体说明是否支持项目级换源...", "Tell users the local mode support"); - // chef_allow_english(this); + // chef_allow_english(this); //项目是否支持英文 chef_forbid_english(this); - // chef_allow_user_define(this); + // chef_allow_user_define(this); //是否支持用户自定义镜像源 chef_forbid_user_define(this); chef_set_note ("中文备注说明...", "English note..."); @@ -141,3 +141,6 @@ void /* 往往统一在 _setsrc() 中实现,直接调用即可 */ // __setsrc (option); } + + +//最后,别忘了将自己的文件加入 menu.c 和 chsrc-main.c 之中嗷~ From 62bbe6de24c6044c0e9fdafaa032fa269772d2d3 Mon Sep 17 00:00:00 2001 From: Mikachu2333 Date: Mon, 18 Aug 2025 19:50:29 +0800 Subject: [PATCH 017/103] avoid vscode autoAddFileAssociations --- .vscode/settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index 74669f2..8939713 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,7 @@ { "editor.fontLigatures": false, + "C_Cpp.autoAddFileAssociations": false, "C_Cpp.intelliSenseEngine": "Tag Parser", "C_Cpp.default.browse.limitSymbolsToIncludedHeaders": false, From 329b97a245eefe933c0b5141d445e9054833da79 Mon Sep 17 00:00:00 2001 From: Mikachu2333 Date: Mon, 18 Aug 2025 20:16:14 +0800 Subject: [PATCH 018/103] fix with suggestions --- lib/xy.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index 87fdf01..64def75 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -19,7 +19,7 @@ #ifndef XY_H #define XY_H -#define _XY_Version "v0.1.6.1-2025/08/18" +#define _XY_Version "v0.1.6.0-2025/08/18" #define _XY_Maintain_URL "https://github.com/RubyMetric/chsrc/blob/dev/lib/xy.h" #define _XY_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc/blob/dev/lib/xy.h" @@ -968,11 +968,6 @@ xy_normalize_path (const char *path) new = xy_2strjoin (xy_os_home, xy_str_delete_prefix (new, "~")); } - // 在特殊情况下上面的替换最终可能导致形如 `/foo//bar/` 之类的东西 - // 建议进行去重处理以防万一 - //new = xy_str_gsub (new, "\\", "/"); - //new = xy_str_gsub (new, "//", "/"); - if (xy_on_windows) return xy_str_gsub (new, "/", "\\"); else From 1a1a863938cd56432bdfb71ee7f6557b32cbdd82 Mon Sep 17 00:00:00 2001 From: Mikachu2333 Date: Mon, 18 Aug 2025 20:18:22 +0800 Subject: [PATCH 019/103] update --- src/recipe/recipe-template.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/recipe/recipe-template.c b/src/recipe/recipe-template.c index 5ee5614..8fc28bb 100644 --- a/src/recipe/recipe-template.c +++ b/src/recipe/recipe-template.c @@ -59,28 +59,28 @@ void __prelude (void) { use_this(_); - chef_allow_gsr(_); //代表支持 Get Set Reset 三种操作 - // chef_allow_s(_); //以此类推 + chef_allow_gsr(_); // 代表支持 Get Set Reset 三种操作 + // chef_allow_s(_); // 以此类推 // chef_allow_gs(_); // chef_allow_sr(_); - chef_set_created_on (this, "2024-08-09"); //文件创建日期 - chef_set_last_updated (this, "2025-08-12"); //文件最后一次更新日期 - chef_set_sources_last_updated (this, "2025-08-11"); //镜像站点最后一次更新日期 + chef_set_created_on (this, "2024-08-09"); // 文件创建日期 + chef_set_last_updated (this, "2025-08-12"); // 文件最后一次更新日期 + chef_set_sources_last_updated (this, "2025-08-11"); // 镜像站点最后一次更新日期 - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); //作者 + chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); // 作者 chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); //想一直为它贡献和更新?将自己加在这里! - chef_set_contributors (this, 1, //为它做了贡献?将自己的信息加在这里! + chef_set_cooks (this, 0); // 想一直为它贡献和更新?将自己加在这里! + chef_set_contributors (this, 1, // 为它做了贡献?将自己的信息加在这里! "Nil Null", "nil@null.org"); chef_allow_local_mode (this, PartiallyCan, "具体说明是否支持项目级换源...", "Tell users the local mode support"); - // chef_allow_english(this); //项目是否支持英文 + // chef_allow_english(this); // 项目是否支持英文 chef_forbid_english(this); - // chef_allow_user_define(this); //是否支持用户自定义镜像源 + // chef_allow_user_define(this); // 是否支持用户自定义镜像源 chef_forbid_user_define(this); chef_set_note ("中文备注说明...", "English note..."); @@ -143,4 +143,5 @@ void } -//最后,别忘了将自己的文件加入 menu.c 和 chsrc-main.c 之中嗷~ +// 最后,请将自己的文件加入到 menu.c 和 chsrc-main.c 对应的位置 +// 形式可以参考其附近的其他食谱 From 62341da96d0563d07007f468c698d9e5661a6e67 Mon Sep 17 00:00:00 2001 From: Mikachu2333 Date: Sun, 17 Aug 2025 13:55:12 +0800 Subject: [PATCH 020/103] improve --- src/recipe/ware/WinGet.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/recipe/ware/WinGet.c b/src/recipe/ware/WinGet.c index 2ffccf1..bd57e3e 100644 --- a/src/recipe/ware/WinGet.c +++ b/src/recipe/ware/WinGet.c @@ -11,13 +11,13 @@ wr_winget_prelude () chef_allow_gsr(wr_winget); chef_set_created_on (this, "2024-06-07"); - chef_set_last_updated (this, "2025-07-13"); + chef_set_last_updated (this, "2025-08-17"); chef_set_sources_last_updated (this, "2025-07-13"); chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); chef_set_chef (this, NULL, NULL); chef_set_cooks (this, 0); - chef_set_contributors (this, 0); + chef_set_contributors (this, 1, "Mikachu2333", "mikachu.23333@zohomail.com"); chef_forbid_english(this); chef_allow_user_define(this); @@ -46,9 +46,14 @@ wr_winget_getsrc (char *option) void wr_winget_setsrc (char *option) { - use_this_source(wr_winget); + use_this_source (wr_winget); - chsrc_run ("winget source remove winget", RunOpt_Default); + // TODO:此处需要增加管理员权限校验 + char *msg = ENGLISH ? "This command needs ADMIN privilege" : "本命令需要管理员权限"; + chsrc_warn (msg); + + // 2025.8.17 此前用户可能隐式使用默认源导致 remove 失败,故使用 Dont_Abort + chsrc_run ("winget source remove winget", RunOpt_Dont_Abort_On_Failure); chsrc_run (xy_strjoin (3, "winget source add winget ", source.url, " --trust-level trusted"), RunOpt_Default); chsrc_determine_chgtype (ChgType_Auto); From 80f4690b141876a4c52d01d9ae83bfeb8a1b609e Mon Sep 17 00:00:00 2001 From: Mikachu2333 Date: Sun, 17 Aug 2025 14:20:23 +0800 Subject: [PATCH 021/103] remove warn msg --- src/recipe/ware/WinGet.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/recipe/ware/WinGet.c b/src/recipe/ware/WinGet.c index bd57e3e..e8ed3d1 100644 --- a/src/recipe/ware/WinGet.c +++ b/src/recipe/ware/WinGet.c @@ -48,10 +48,6 @@ wr_winget_setsrc (char *option) { use_this_source (wr_winget); - // TODO:此处需要增加管理员权限校验 - char *msg = ENGLISH ? "This command needs ADMIN privilege" : "本命令需要管理员权限"; - chsrc_warn (msg); - // 2025.8.17 此前用户可能隐式使用默认源导致 remove 失败,故使用 Dont_Abort chsrc_run ("winget source remove winget", RunOpt_Dont_Abort_On_Failure); chsrc_run (xy_strjoin (3, "winget source add winget ", source.url, " --trust-level trusted"), RunOpt_Default); From 03af965c4e922e6b7a50167f053db1aeebda40a8 Mon Sep 17 00:00:00 2001 From: Mikachu2333 Date: Sun, 17 Aug 2025 15:51:09 +0800 Subject: [PATCH 022/103] fix --- src/recipe/ware/WinGet.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/recipe/ware/WinGet.c b/src/recipe/ware/WinGet.c index e8ed3d1..37af8f0 100644 --- a/src/recipe/ware/WinGet.c +++ b/src/recipe/ware/WinGet.c @@ -49,6 +49,8 @@ wr_winget_setsrc (char *option) use_this_source (wr_winget); // 2025.8.17 此前用户可能隐式使用默认源导致 remove 失败,故使用 Dont_Abort + // 我也不知道为啥执行两次就可以了,但是确实是能用了…… + chsrc_run ("winget source remove winget", RunOpt_Dont_Abort_On_Failure); chsrc_run ("winget source remove winget", RunOpt_Dont_Abort_On_Failure); chsrc_run (xy_strjoin (3, "winget source add winget ", source.url, " --trust-level trusted"), RunOpt_Default); From 978d4c68c43a4fa47ff98ce08f3b22101aed1ebc Mon Sep 17 00:00:00 2001 From: Mikachu2333 Date: Mon, 18 Aug 2025 19:53:08 +0800 Subject: [PATCH 023/103] typo --- src/recipe/ware/WinGet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/recipe/ware/WinGet.c b/src/recipe/ware/WinGet.c index 37af8f0..c37328c 100644 --- a/src/recipe/ware/WinGet.c +++ b/src/recipe/ware/WinGet.c @@ -49,8 +49,8 @@ wr_winget_setsrc (char *option) use_this_source (wr_winget); // 2025.8.17 此前用户可能隐式使用默认源导致 remove 失败,故使用 Dont_Abort - // 我也不知道为啥执行两次就可以了,但是确实是能用了…… chsrc_run ("winget source remove winget", RunOpt_Dont_Abort_On_Failure); + // 2025.8.18 执行两次相同的命令后继续设置,无报错,换源成功。具体原因不明 chsrc_run ("winget source remove winget", RunOpt_Dont_Abort_On_Failure); chsrc_run (xy_strjoin (3, "winget source add winget ", source.url, " --trust-level trusted"), RunOpt_Default); From 3dfe2bb3cf00d74c4ee9cf15a8286e3da95e1c92 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Tue, 19 Aug 2025 09:52:16 +0800 Subject: [PATCH 024/103] Fix xy.c --- test/xy.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/xy.c b/test/xy.c index 3abf3fc..a3b57f9 100644 --- a/test/xy.c +++ b/test/xy.c @@ -7,7 +7,7 @@ * | Mikachu2333 * | * Created On : <2023-08-30> - * Last Modified : <2025-08-18> + * Last Modified : <2025-08-19> * * Test xy.h * ------------------------------------------------------------*/ @@ -127,8 +127,6 @@ main (int argc, char const *argv[]) assert (xy_file_exist (xy_bashrc)); } assert (xy_dir_exist ("/etc")); - assert_str (xy_normalize_path ("a\\b c\\d"), "a/b c/d"); - assert_str (xy_normalize_path ("a\\b c\\d\\"), "a/b c/d/"); } println (xy_normalize_path (" \n ~/haha/test/123 \n\r ")); From 795ed0964fa3dd890ff6cbf95a60da633294ee6d Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Tue, 19 Aug 2025 09:55:03 +0800 Subject: [PATCH 025/103] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=A3=8E=E6=A0=BC=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/03-为什么拒绝使用代码格式化工具.md | 54 +++++++++++--------------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/doc/03-为什么拒绝使用代码格式化工具.md b/doc/03-为什么拒绝使用代码格式化工具.md index 7dfad59..56589b5 100644 --- a/doc/03-为什么拒绝使用代码格式化工具.md +++ b/doc/03-为什么拒绝使用代码格式化工具.md @@ -3,17 +3,15 @@ ! ------------------------------------------------------------- ! Doc Type : Markdown ! Doc Name : 03-为什么拒绝使用代码格式化工具.md - ! Doc Authors : Aoran Zeng - ! Contributors : Nul None + ! Doc Authors : 曾奥然 + ! Contributors : Nul None ! Created On : <2025-08-10> - ! Last Modified : <2025-08-17> + ! Last Modified : <2025-08-18> ! ---------------------------------------------------------- --> # chsrc 代码风格 -`chsrc` 项目的第一作者深受 **Ruby** 语言哲学的影响。Ruby 在编程语言界以其 **"程序员幸福感"** 和优雅语法著称。作者同时对 **Perl poem**(Perl 诗歌)这一独特的艺术形式印象深刻。 - -Ruby 的语法优美性在编程行业中具有标杆地位。Matz(松本行弘)提出的 **代码应该为人类而写,偶尔为机器执行** 这一理念,已经成为现代编程语言设计的重要指导原则。 +Ruby 的语法优美性在编程行业中具有标杆地位。Matz(松本行弘)提出的 **代码应该为人类而写,偶尔为机器执行** 这一理念,已经成为现代编程语言设计的重要指导原则。`chsrc` 项目的第一作者深受 **Ruby** 语言哲学的影响。 本项目起源于 AI 编程尚未流行的时代,所有代码全部依赖人类的耐心来维护。现在,我们的代码以及这篇文章不仅会由人类阅读,也会由 AI 阅读。我们始终坚持:**代码的可读性和维护性是项目长期发展的根本保障**。 @@ -25,11 +23,25 @@ Ruby 的语法优美性在编程行业中具有标杆地位。Matz(松本行 代码格式化工具(code formatter)在多人协作的代码仓库中确实有其价值,**参与的人越多,统一格式的需求越迫切**。然而,`chsrc` 项目经过深思熟虑后,拒绝使用代码格式化工具。让我来说明这一决定背后的深层原因。 -像 `Prettier` 这样的工具表面上带来了统一性,但其代价是什么?**它是极度专制的(opiniated)**,这意味着为了获得表面的一致性,我们必须**完全交出代码审美的自主权**。今天我们大部分人使用 `Prettier`,**并非出于真心的认同,而是因为整个前端生态圈的集体胁迫——不用就意味着被边缘化**。每一个有追求的程序员都应该保留**对代码美学的最后决定权,格式化工具的便利性不应该以牺牲美观性和可维护性为代价**。 +### 被强迫使用 + +像 `Prettier` 这样的工具表面上带来了统一性,但其代价是什么?**它是极度专制的(opiniated)**,我们必须**完全交出代码审美的自主权**。今天我们大部分人使用 `Prettier`,**并非出于真心的认同,而是因为整个前端生态圈的集体胁迫——不用就意味着被边缘化**。 这种现象的本质令人深思:**少数 `Prettier` 维护者的个人偏好,竟然决定了全球数百万开发者的代码美学标准。这显然是一种技术独裁,坚决拒绝向格式化工具的霸权低头**。 -C语言的格式化工具通常选择 `clang-format`,它的配置选项十分丰富,比 `Prettier` 要理性得多。然而,即便如此,**其配置的复杂性和局限性仍然无法满足 chsrc 对代码美学的严苛要求**。如果你是一位 `clang-format` 的配置专家,我们诚挚邀请您告诉我们如何优雅地处理以下代码场景,**也许这能改变我的立场**。 +
+ +### 一致性 ≠ 美观 ≠ 可读 + +格式化工具只保证了表面的一致性,就像一些校服,一致不一定代表美。同样,一致不一定代表代码就是最易读易懂的。 + +每一个有追求的程序员都应该保留**对代码美学的最后决定权,格式化工具的便利性不应该以牺牲美观性和可维护性为代价**。 + +
+ +### 满足不了我们的需求 + +C语言的格式化工具通常选择 `clang-format`,它的配置选项十分丰富,比 `Prettier` 要理性得多。然而,即便如此,**其配置的复杂性和局限性仍然无法满足 chsrc 对代码格式的严苛要求**。如果你是一位 `clang-format` 的配置专家,我们诚挚邀请您告诉我们如何优雅地处理以下代码场景,**也许这能改变我的立场**。
@@ -42,8 +54,8 @@ C语言的格式化工具通常选择 `clang-format`,它的配置选项十分 `=` 对齐: ```c -char *name = va_arg(args, char*); -char *email = va_arg(args, char*); +char *name = va_arg (args, char*); +char *email = va_arg (args, char*); ``` 复杂逻辑的 `=` 对齐: @@ -78,30 +90,10 @@ if (!matched) matched = iterate_menu (chsrc_wr_menu, input, &target_tmp); - 类型名: `PascalCase_t` -- 函数定义时,函数名和`()`之间始终保持一个空格 +- 函数定义和调用时,**函数名和`()`之间始终保持一个空格**,如果是在宏中,可紧凑一些,无硬性规定 - 函数和函数定义之间保持**2个空行**,若一系列函数和一系列函数存在主题性区别,**可用3个空行** -- 函数调用时,函数名和`()`之间应当保持一个空格 - - 例外: 当函数参数为0或1时不用保持该空格。 - - 但若该函数参数过长如很长的字符串,又或嵌套了函数,我们仍然保持一个空格。 - -```c -// 一般函数调用都空格,因为这是 GNU 风格最显著的特征之一 -func (1, 2); - -// 当函数参数为0或1时不用保持空格,因为能更紧凑一些 -br(); -red("string"); - -// 但如果有函数嵌套,即使参数只有1个,外部函数还是要保持空格,这样清晰得多 -func1 (func2("string")); -// 如果参数过长,即使参数只有1个,也应该保持空格 -red ("loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong string"); -``` -
From b6a910143d8b28f77c1809738c60884ef67736f3 Mon Sep 17 00:00:00 2001 From: Mikachu2333 Date: Wed, 20 Aug 2025 10:45:08 +0800 Subject: [PATCH 026/103] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F`which`=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#271)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/core.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/framework/core.c b/src/framework/core.c index ec6390f..47d44b6 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -339,29 +339,33 @@ query_program_exist (char *check_cmd, char *prog_name, int mode) /** - * @brief 生成用于 '检测一个程序是否存在' 的命令,该内部函数由 chsrc_check_program() 家族调用 + * @brief 生成用于 “检测一个程序是否存在” 的命令,该内部函数由 chsrc_check_program() 家族调用 * - * 检查一个程序是否存在时,我们曾经使用 "调用 程序名 --version" 的方式 (即 cmd_to_check_program2()), - * 但是该方式有三个问题: - * - * 1. 该程序得到直接执行,可能不太安全 (虽然基本不可能) - * 2. 有一些程序启动速度太慢,即使只调用 --version,也依旧会花费许多时间,比如 mvn - * 3. 有些程序并不支持 --version 选项 (虽然基本不可能) - * - * @note Unix 中,where 仅在 zsh 中可以使用,sh 和 Bash 中均无法使用,因为其并非二进制程序 - * 所以在 Unix 中,只能使用 which 或 whereis + * @note + * 1. Unix 中,where 仅在 zsh 中可以使用,sh 和 Bash 中均无法使用,因为其并非二进制程序 + * 2. 因部分linux系统没有 `which` 和 `whereis` 命令,使用 `command -v` 代替 */ static char * cmd_to_check_program (char *prog_name) { - char *check_tool = xy_on_windows ? "where " : "which "; + char *check_tool = xy_on_windows ? "where " : "command -v "; char *quiet_cmd = xy_str_to_quietcmd (xy_2strjoin (check_tool, prog_name)); return quiet_cmd; } + XY_Deprecate_This("Use cmd_to_check_program() instead") +/** + * @brief 通过 `调用程序名 --version` 的方式检测程序是否存在 + * + * @deprecated 因存在以下三个问题弃用: + * + * 1. 该程序得到直接执行,可能不太安全 (虽然基本不可能) + * 2. 有一些程序启动速度太慢,即使只调用 --version,也依旧会花费许多时间,比如 mvn + * 3. 有些程序并不支持 --version 选项 (虽然基本不可能) + */ static char * cmd_to_check_program2 (char *prog_name) { From 34fa12eddea3fc1ee858bbaa58c89d68a1a712f0 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 11:32:37 +0800 Subject: [PATCH 027/103] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20`xy=5Fnoop()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 1 + src/framework/core.c | 2 +- src/recipe/ware/Homebrew/Homebrew.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index 64def75..e81d492 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -102,6 +102,7 @@ bool xy_enable_color = true; #define xy_unsupported() assert(!"Unsuppoted") #define xy_unimplemented() assert(!"Unimplemented temporarily") #define xy_unreached() assert(!"This code shouldn't be reached") +#define xy_noop() (void)0 static void _xy_print_int (int n) {printf ("%d", n);} static void _xy_print_long (long n) {printf ("%ld", n);} diff --git a/src/framework/core.c b/src/framework/core.c index 47d44b6..fb7ec9a 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -1509,7 +1509,7 @@ chsrc_view_env (const char *var1, ...) */ // chsrc_run (cmd, RunOpt_Dont_Notify_On_Success|RunOpt_No_Last_New_Line|RunOpt_Dont_Abort_On_Failure); int status = system (cmd); - if (status!=0) {/* NOOP */} + if (status!=0) { xy_noop(); } } else { diff --git a/src/recipe/ware/Homebrew/Homebrew.c b/src/recipe/ware/Homebrew/Homebrew.c index 525cd69..fedb71d 100644 --- a/src/recipe/ware/Homebrew/Homebrew.c +++ b/src/recipe/ware/Homebrew/Homebrew.c @@ -43,7 +43,7 @@ void wr_homebrew_getsrc (char *option) { int status = system (RAWSTR_wr_homebrew_read_config_cmd); - if (status != 0) { /* NOOP */ } + if (status != 0) { xy_noop(); } } /** From 6178b212a0ddc0bec547b914b3b33221031f1a00 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 11:42:45 +0800 Subject: [PATCH 028/103] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20`echo()`=20?= =?UTF-8?q?=E5=B9=B6=E4=BD=BF=E7=94=A8=20`@flavor`=20=E6=A0=87=E6=B3=A8API?= =?UTF-8?q?=E5=8F=82=E8=80=83=E4=BE=9D=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index e81d492..60b888b 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -2,18 +2,22 @@ * Copyright © 2023-2025 Aoran Zeng, Heng Guo * SPDX-License-Identifier: MIT * ------------------------------------------------------------- - * Lib Name : xy.h - * Lib Authors : Aoran Zeng - * | Heng Guo <2085471348@qq.com> - * Contributors : juzeon + * Lib Name : xy.h + * Lib Authors : 曾奥然 + * | 郭恒 <2085471348@qq.com> + * Contributors : juzeon * | Mikachu2333 * | * Created On : <2023-08-28> - * Last Modified : <2025-08-18> + * Last Modified : <2025-08-20> * - * xy: 襄阳、咸阳 - * Corss-Platform C11 utilities for CLI applications in mixed - * flavor (mostly Ruby) + * + * xy: 襄阳、咸阳 + * + * 为跨平台命令行应用程序准备的 C11 实用函数和宏 (utilities) + * + * 该库的特点是混合多种编程语言风味 (绝大多数为 Ruby),每个 API + * 均使用 @flavor 标注其参考依据 * ------------------------------------------------------------*/ #ifndef XY_H @@ -145,8 +149,11 @@ static void _xy_println_const_str (const char *str) {printf ("%s\n", str);} const char *: _xy_println_const_str, \ default: assert(!"Unsupported type for println()/say()!") \ )(x) +/* @flavor Perl/Raku */ #define say println - +/* @flavor PHP */ +#define echo println +/* @flavor HTML */ void br () { puts (""); } void p (const char *s) { printf ("%s\n", s); } From 6fb86774512e66d2fdfc85a08438fe356ee57657 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 12:02:37 +0800 Subject: [PATCH 029/103] =?UTF-8?q?=E6=A0=87=E6=B3=A8=E6=9B=B4=E5=A4=9A=20?= =?UTF-8?q?flavor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index 60b888b..fbfb418 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -126,6 +126,9 @@ static void _xy_println_bool (bool b) {printf("%s\n", (b) ? "true" : "false"); static void _xy_println_str (char *str) {printf ("%s\n", str);} static void _xy_println_const_str (const char *str) {printf ("%s\n", str);} +/** + * @flavor Ruby, Python + */ #define print(x) _Generic((x), \ int: _xy_print_int, \ long: _xy_print_long, \ @@ -138,6 +141,9 @@ static void _xy_println_const_str (const char *str) {printf ("%s\n", str);} default: assert(!"Unsupported type for print()!") \ )(x) +/** + * @flavor JVM family, Rust + */ #define println(x) _Generic((x), \ int: _xy_println_int, \ long: _xy_println_long, \ @@ -153,12 +159,16 @@ static void _xy_println_const_str (const char *str) {printf ("%s\n", str);} #define say println /* @flavor PHP */ #define echo println -/* @flavor HTML */ +/** + * @flavor HTML + */ void br () { puts (""); } void p (const char *s) { printf ("%s\n", s); } + #define xy_arylen(x) (sizeof (x) / sizeof (x[0])) + static inline void * xy_malloc0 (size_t size) { @@ -175,6 +185,8 @@ xy_malloc0 (size_t size) /** * @brief 将 str 中所有的 pat 字符串替换成 replace,返回一个全新的字符串;也可用作删除、缩小、扩张 * + * @flavor Ruby: String#gsub + * * @param str 原字符串 * @param pat 要替换的字符串 * @param replace 替换成的字符串 @@ -409,6 +421,7 @@ new_str: return buf; } + static bool xy_streql (const char *str1, const char *str2) { @@ -444,6 +457,7 @@ xy_streql_ic(const char *str1, const char *str2) return true; } + static char * xy_str_to_quietcmd (const char *cmd) { @@ -456,6 +470,10 @@ xy_str_to_quietcmd (const char *cmd) return ret; } + +/** + * @flavor Ruby: String#end_with? + */ static bool xy_str_end_with (const char *str, const char *suffix) { @@ -480,6 +498,9 @@ xy_str_end_with (const char *str, const char *suffix) return true; } +/** + * @flavor Ruby: String#start_with? + */ static bool xy_str_start_with (const char *str, const char *prefix) { @@ -509,6 +530,9 @@ xy_str_start_with (const char *str, const char *prefix) return true; } +/** + * @flavor Ruby: String#delete_prefix + */ static char * xy_str_delete_prefix (const char *str, const char *prefix) { @@ -522,6 +546,9 @@ xy_str_delete_prefix (const char *str, const char *prefix) return cur; } +/** + * @flavor Ruby: String#delete_suffix + */ static char * xy_str_delete_suffix (const char *str, const char *suffix) { @@ -537,6 +564,9 @@ xy_str_delete_suffix (const char *str, const char *suffix) return new; } +/** + * @flavor Ruby: String#strip + */ static char * xy_str_strip (const char *str) { @@ -626,7 +656,7 @@ _xy_log (int level, const char *prompt, const char *content) /** - * brkt 系列输出受 pip 启发,为了输出方便,使用 xy.h 的程序应该 + * @flavor brkt 系列输出受 Python 的 pip 启发,为了输出方便,使用 xy.h 的程序应该 * * 1.若想完全自定义颜色和输出位置: * @@ -778,7 +808,8 @@ xy_run (const char *cmd, unsigned long n) ******************************************************/ /** - * @note 该函数同 just 中的 os_family(),只区分 windows, unix + * @flavor 该函数同 just 中的 os_family(),只区分 windows, unix + * * @return 返回 "windows" 或 "unix" */ #define xy_os_family _xy_os_family () From 9023f8d0e70c43498a84ff129d57d36325dac813 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 12:25:08 +0800 Subject: [PATCH 030/103] Rename `xy_strjoin()` to `xy_strcat()` --- lib/xy.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index fbfb418..8becdcd 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -246,8 +246,12 @@ xy_str_gsub (const char *str, const char *pat, const char *replace) return ret; } + +/** + * @flavor 见 xy_strcat() + */ static char * -xy_2strjoin (const char *str1, const char *str2) +xy_2strcat (const char *str1, const char *str2) { size_t len = strlen (str1); size_t size = len + strlen (str2) + 1; @@ -257,17 +261,26 @@ xy_2strjoin (const char *str1, const char *str2) return ret; } +/* @deprecated 应迁移到后者 */ +#define xy_2strjoin xy_2strcat /** * @brief 将多个字符串连接成一个字符串 * + * @flavor C语言存在 strcat(),然而限制比较大,我们重新实现 + + * `concat` 这个API广泛应用于包括 Ruby、JavaScript、JVM family、C# + * + * 但由于 xy_str_concat() 显著长于 xy_strcat(),而这个 API 在 chsrc 中 + * 又大量使用,所以我们选择后者这个更简短的形式 + * * @param count 连接的字符串数量 * @param ... 连接的字符串 * * @return 拼接的新字符串 */ static char * -xy_strjoin (unsigned int count, ...) +xy_strcat (unsigned int count, ...) { size_t al_fixed = 256; char *ret = calloc (1, al_fixed); @@ -320,6 +333,9 @@ xy_strjoin (unsigned int count, ...) return ret; } +/* @deprecated 应迁移到后者 */ +#define xy_strjoin xy_strcat + /** * @brief 复制一个字符串,返回复制的新字符串 From c33a9dafd0cf913f56f92ba12d2bee7dff414840 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 12:30:27 +0800 Subject: [PATCH 031/103] Rename `xy_arylen()` to `xy_c_array_len()` --- lib/xy.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/xy.h b/lib/xy.h index 8becdcd..e973a3d 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -166,7 +166,10 @@ void br () { puts (""); } void p (const char *s) { printf ("%s\n", s); } -#define xy_arylen(x) (sizeof (x) / sizeof (x[0])) +#define xy_c_array_len(arr) (sizeof (arr) / sizeof (arr[0])) + +/* @deprecated 应迁移到后者 */ +#define xy_arylen xy_c_array_len static inline void * From e2c85250271b44d83fd66f3e973c7830f0da2098 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 13:01:46 +0800 Subject: [PATCH 032/103] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20`xy=5Fseq=5Fpush()?= =?UTF-8?q?`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/lib/xy.h b/lib/xy.h index e973a3d..4a1972f 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -1068,4 +1068,75 @@ xy_parent_dir (const char *path) return dir; } + + +/****************************************************** + * Container + ******************************************************/ + +typedef struct XySeq_t +{ + XySeqItem_t *first_item; + xySeqItem_t *last_item; + + uint32_t length; +} +XySeq_t; + +typedef struct XySeqItem_t +{ + XySeqItem_t *next; + + void *data; +} +XySeqItem_t; + + +XySeq_t* +xy_new_seq (void) +{ + XySeq_t *seq = xy_malloc0 (sizeof (XySeq_t)); + if (!seq) return NULL; + + seq->first_item = NULL; + seq->last_item = NULL; + seq->length = 0; + + return seq; +} + + +/** + * @flavor Perl: push + */ +XySeq_t* +xy_seq_push (XySeq_t *seq, void *data) +{ + if (!seq) return NULL; + + XySeqItem_t *it = xy_malloc0 (sizeof (XySeqItem_t)); + if (!it) return NULL; + + it->data = data; + it->next = NULL; + + if (seq->last) + { + // 旧的最后项成为倒数第二项 + seq->last_item->next = it; + } + // it 成为新的最后一项 + seq->last_item = it; + + // 若 seq 为空,成为第一项 + if (!seq->first_item) + { + seq->first_item = it; + } + + seq->length++; + + return seq; +} + #endif From 77a3b458bd8792fd6d4d52211d4c3887029b68cb Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 13:31:15 +0800 Subject: [PATCH 033/103] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=20`xy=5Fseq=5Fpop()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 49 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index 4a1972f..8cadf51 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -1085,6 +1085,7 @@ XySeq_t; typedef struct XySeqItem_t { + XySeqItem_t *prev; XySeqItem_t *next; void *data; @@ -1109,7 +1110,7 @@ xy_new_seq (void) /** * @flavor Perl: push */ -XySeq_t* +void xy_seq_push (XySeq_t *seq, void *data) { if (!seq) return NULL; @@ -1118,25 +1119,49 @@ xy_seq_push (XySeq_t *seq, void *data) if (!it) return NULL; it->data = data; + it->prev = NULL; it->next = NULL; - if (seq->last) + // 更新 item 间关系 + if (XySeqItem_t *l = seq->last_item;) { - // 旧的最后项成为倒数第二项 - seq->last_item->next = it; + it->prev = l; + l->next = it; } - // it 成为新的最后一项 - seq->last_item = it; - // 若 seq 为空,成为第一项 - if (!seq->first_item) - { - seq->first_item = it; - } + // 更新 seq 信息 + seq->last_item = it; + if (0==seq->length) + seq->first_item = it; seq->length++; +} - return seq; + +/** + * @flavor Perl: pop + */ +void * +xy_seq_pop (XySeq_t *seq) +{ + if (!seq || 0==seq->length) return NULL; + + // 更新 item 间关系 + XySeqItem_t *l = seq->last_item; + XySeqItem_t *p = l->prev; + // 考虑 seq 当前只有1项的情况 + if (p) p->next = NULL; + l->prev = NULL; + + // 更新 seq 信息 + seq->last_item = p; + // 考虑 seq 当前只有1项的情况 + if (!p) seq->first_item = NULL; + seq->length--; + + void *data = l->data; + free (l); + return data; } #endif From 57d81b2edd2f41633a7a342028086aac1dfb0d6c Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 14:57:03 +0800 Subject: [PATCH 034/103] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=20`xy=5Fseq=5Feach/l?= =?UTF-8?q?en/first/last()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/lib/xy.h b/lib/xy.h index 8cadf51..e7e7acb 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -1094,7 +1094,7 @@ XySeqItem_t; XySeq_t* -xy_new_seq (void) +xy_seq_new (void) { XySeq_t *seq = xy_malloc0 (sizeof (XySeq_t)); if (!seq) return NULL; @@ -1106,6 +1106,35 @@ xy_new_seq (void) return seq; } +/** + * @flavor Python: len() + */ +uint32_t +xy_seq_len (XySeq_t *seq) +{ + return seq->length; +} + +/** + * @flavor Ruby: Enumerable#first + */ +void * +xy_seq_first (XySeq_t *seq) +{ + if (!seq) return NULL; + return seq->first_item ? seq->first_item->data : NULL; +} + +/** + * @flavor Ruby: Enumerable#last + */ +void * +xy_seq_last (XySeq_t *seq) +{ + if (!seq) return NULL; + return seq->last_item ? seq->last_item->data : NULL; +} + /** * @flavor Perl: push @@ -1164,4 +1193,19 @@ xy_seq_pop (XySeq_t *seq) return data; } + +/** + * @flavor Ruby: Array#each + */ +void +xy_seq_each (XySeq_t *seq, void (*func)(void *)) +{ + if (!seq || !func) return; + + for (XySeqItem_t *it = seq->first_item; it; it = it->next) + { + func (it->data); + } +} + #endif From 2692f07a2bde625264c0d8838329ac1f86ac8f74 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 15:06:50 +0800 Subject: [PATCH 035/103] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20`xy=5Fcant=5Fbe=5F?= =?UTF-8?q?null()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index e7e7acb..0fb9e25 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -107,6 +107,7 @@ bool xy_enable_color = true; #define xy_unimplemented() assert(!"Unimplemented temporarily") #define xy_unreached() assert(!"This code shouldn't be reached") #define xy_noop() (void)0 +#define xy_cant_be_null(p) if(!p) assert(!"This pointer can't be null") static void _xy_print_int (int n) {printf ("%d", n);} static void _xy_print_long (long n) {printf ("%ld", n);} @@ -1112,6 +1113,7 @@ xy_seq_new (void) uint32_t xy_seq_len (XySeq_t *seq) { + xy_cant_be_null (seq); return seq->length; } @@ -1121,7 +1123,7 @@ xy_seq_len (XySeq_t *seq) void * xy_seq_first (XySeq_t *seq) { - if (!seq) return NULL; + xy_cant_be_null (seq); return seq->first_item ? seq->first_item->data : NULL; } @@ -1131,7 +1133,7 @@ xy_seq_first (XySeq_t *seq) void * xy_seq_last (XySeq_t *seq) { - if (!seq) return NULL; + xy_cant_be_null (seq); return seq->last_item ? seq->last_item->data : NULL; } @@ -1142,7 +1144,7 @@ xy_seq_last (XySeq_t *seq) void xy_seq_push (XySeq_t *seq, void *data) { - if (!seq) return NULL; + xy_cant_be_null (seq); XySeqItem_t *it = xy_malloc0 (sizeof (XySeqItem_t)); if (!it) return NULL; @@ -1173,7 +1175,9 @@ xy_seq_push (XySeq_t *seq, void *data) void * xy_seq_pop (XySeq_t *seq) { - if (!seq || 0==seq->length) return NULL; + xy_cant_be_null (seq); + + if (0==seq->length) return NULL; // 更新 item 间关系 XySeqItem_t *l = seq->last_item; @@ -1200,7 +1204,8 @@ xy_seq_pop (XySeq_t *seq) void xy_seq_each (XySeq_t *seq, void (*func)(void *)) { - if (!seq || !func) return; + xy_cant_be_null (seq); + xy_cant_be_null (func); for (XySeqItem_t *it = seq->first_item; it; it = it->next) { From b4e2a56abcfcd7a1aade965d1912077dc007e91a Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 15:34:05 +0800 Subject: [PATCH 036/103] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=20`xy=5Fseq=5Fat()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 53 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index 0fb9e25..0e30de4 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -1074,25 +1074,24 @@ xy_parent_dir (const char *path) /****************************************************** * Container ******************************************************/ - -typedef struct XySeq_t -{ - XySeqItem_t *first_item; - xySeqItem_t *last_item; - - uint32_t length; -} -XySeq_t; - typedef struct XySeqItem_t { - XySeqItem_t *prev; - XySeqItem_t *next; + struct XySeqItem_t *prev; + struct XySeqItem_t *next; void *data; } XySeqItem_t; +typedef struct XySeq_t +{ + XySeqItem_t *first_item; + XySeqItem_t *last_item; + + uint32_t length; +} +XySeq_t; + XySeq_t* xy_seq_new (void) @@ -1137,6 +1136,30 @@ xy_seq_last (XySeq_t *seq) return seq->last_item ? seq->last_item->data : NULL; } +/** + * @flavor Ruby: Array#at + * + * @note 序号从1开始 + * + * @return 如果seq中并没有第n个数据,则返回NULL + */ +void * +xy_seq_at (XySeq_t *seq, int n) +{ + xy_cant_be_null (seq); + + if (0 == n) assert (!"The index must begin from 1, not 0"); + + if (1 == n) return seq->first_item ? seq->first_item->data : NULL; + + XySeqItem_t *it = seq->first_item; + for (uint32_t i = 1; i < n && it; i++) + { + it = it->next; + } + return it ? it->data : NULL; +} + /** * @flavor Perl: push @@ -1146,15 +1169,15 @@ xy_seq_push (XySeq_t *seq, void *data) { xy_cant_be_null (seq); - XySeqItem_t *it = xy_malloc0 (sizeof (XySeqItem_t)); - if (!it) return NULL; + XySeqItem_t *it = xy_malloc0 (sizeof (XySeqItem_t));; it->data = data; it->prev = NULL; it->next = NULL; // 更新 item 间关系 - if (XySeqItem_t *l = seq->last_item;) + XySeqItem_t *l = seq->last_item; + if (l) { it->prev = l; l->next = it; From 0a421eb1cb942229d9c0ea35f54c8c677d8d5c26 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 15:34:29 +0800 Subject: [PATCH 037/103] =?UTF-8?q?=E6=B5=8B=E8=AF=95=20seq?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/xy.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/test/xy.c b/test/xy.c index a3b57f9..98ebc1b 100644 --- a/test/xy.c +++ b/test/xy.c @@ -1,19 +1,24 @@ /** ------------------------------------------------------------ * SPDX-License-Identifier: MIT * ------------------------------------------------------------- - * File Name : xy.c - * File Authors : Aoran Zeng - * Contributors : Nil Null - * | Mikachu2333 - * | + * Test File : xy.c + * Test Authors : 曾奥然 + * Contributors : Mikachu2333 * Created On : <2023-08-30> - * Last Modified : <2025-08-19> + * Last Modified : <2025-08-20> * * Test xy.h * ------------------------------------------------------------*/ #include "xy.h" +void +print_str (void *str) +{ + print ((char *) str); +} + + int main (int argc, char const *argv[]) { @@ -132,6 +137,18 @@ main (int argc, char const *argv[]) println (xy_normalize_path (" \n ~/haha/test/123 \n\r ")); assert_str (xy_normalize_path ("~/haha/test"), xy_parent_dir (" ~/haha/test/123")); + + + XySeq_t *seq = xy_seq_new (); + xy_seq_push (seq, "Hello"); + xy_seq_push (seq, "World"); + assert_str ("Hello", xy_seq_at (seq, 1)); + assert_str ("World", xy_seq_at (seq, 2)); + xy_seq_each (seq, print_str); + xy_seq_pop (seq); + assert (1 == xy_seq_len (seq)); + + xy_succ ("测试完成", "xy.h 测试全部通过"); // xy_unimplemented(); From ad087be36a2b8b966debd35977f03653c8a613d6 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 16:15:32 +0800 Subject: [PATCH 038/103] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=20`xy=5Fmap=5Fset()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/lib/xy.h b/lib/xy.h index 0e30de4..3abb803 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -1236,4 +1236,79 @@ xy_seq_each (XySeq_t *seq, void (*func)(void *)) } } + +#define _XY_Map_Buckets_Count 97 + +struct _XyHashBucket_t +{ + struct _XyHashBucket_t *next; + char *key; + void *value; +}; + +typedef struct XyMap_t +{ + struct _XyHashBucket_t **buckets; + + uint32_t length; +} +XyMap_t; + + +XyMap_t * +xy_map_new () +{ + XyMap_t *map = xy_malloc0 (sizeof (XyMap_t)); + map->buckets = xy_malloc0 (sizeof (struct _XyHashBucket_t *) * _XY_Map_Buckets_Count); + + map->length = 0; + + return map; +} + + +unsigned long +xy_hash (const char* str) +{ + unsigned long h = 5381; + int c; + while ((c = *str++)) + h = ((h << 5) + h) + c; /* h * 33 + c */ + return h; +} + + +void +xy_map_set (XyMap_t *map, const char *key, void *value) +{ + xy_cant_be_null (map); + xy_cant_be_null (key); + + unsigned long hash = xy_hash (key); + uint32_t index = hash % _XY_Map_Buckets_Count; + + // 若 key 已经存在 + _XyHashBucket_t *maybe = map->buckets[index]; + while (maybe) + { + if (xy_streql (maybe->key, key)) + { + maybe->value = value; + return; + } + maybe = maybe->next; + } + + // 若 key 不存在 + _XyHashBucket_t *bucket = xy_malloc0 (sizeof (struct _XyHashBucket_t)); + + bucket->key = xy_strdup (key); + bucket->value = value; + bucket->next = map->buckets[index]; + map->buckets[index] = bucket; + + map->length++; +} + + #endif From 560a47f3589ccb286a55def0595be21c512257a1 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 16:37:35 +0800 Subject: [PATCH 039/103] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=20`xy=5Fmap=5Fget/ea?= =?UTF-8?q?ch()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index 3abb803..c05c09b 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -1237,6 +1237,7 @@ xy_seq_each (XySeq_t *seq, void (*func)(void *)) } + #define _XY_Map_Buckets_Count 97 struct _XyHashBucket_t @@ -1267,6 +1268,14 @@ xy_map_new () } +uint32_t +xy_map_len (XyMap_t *map) +{ + xy_cant_be_null (map); + return map->length; +} + + unsigned long xy_hash (const char* str) { @@ -1278,6 +1287,9 @@ xy_hash (const char* str) } +/** + * @flavor JavaScript: map.set + */ void xy_map_set (XyMap_t *map, const char *key, void *value) { @@ -1288,7 +1300,7 @@ xy_map_set (XyMap_t *map, const char *key, void *value) uint32_t index = hash % _XY_Map_Buckets_Count; // 若 key 已经存在 - _XyHashBucket_t *maybe = map->buckets[index]; + struct _XyHashBucket_t *maybe = map->buckets[index]; while (maybe) { if (xy_streql (maybe->key, key)) @@ -1300,7 +1312,7 @@ xy_map_set (XyMap_t *map, const char *key, void *value) } // 若 key 不存在 - _XyHashBucket_t *bucket = xy_malloc0 (sizeof (struct _XyHashBucket_t)); + struct _XyHashBucket_t *bucket = xy_malloc0 (sizeof (struct _XyHashBucket_t)); bucket->key = xy_strdup (key); bucket->value = value; @@ -1311,4 +1323,51 @@ xy_map_set (XyMap_t *map, const char *key, void *value) } +/** + * @flavor JavaScript: map.get + */ +void * +xy_map_get (XyMap_t *map, const char *key) +{ + xy_cant_be_null (map); + xy_cant_be_null (key); + + unsigned long hash = xy_hash (key); + uint32_t index = hash % _XY_Map_Buckets_Count; + + struct _XyHashBucket_t *maybe = map->buckets[index]; + while (maybe) + { + if (xy_streql (maybe->key, key)) + { + return maybe->value; + } + maybe = maybe->next; + } + + return NULL; +} + + +/** + * @flavor Ruby: Hash#each + */ +void +xy_map_each (XyMap_t *map, void (*func)(const char *key, void *value)) +{ + xy_cant_be_null (map); + xy_cant_be_null (func); + + for (uint32_t i = 0; i < _XY_Map_Buckets_Count; i++) + { + struct _XyHashBucket_t *bucket = map->buckets[i]; + while (bucket) + { + func (bucket->key, bucket->value); + bucket = bucket->next; + } + } +} + + #endif From 51b6ece5b76aec0e607b677ff78505bc2b19401d Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 16:37:54 +0800 Subject: [PATCH 040/103] =?UTF-8?q?=E6=B5=8B=E8=AF=95=20map?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/xy.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/test/xy.c b/test/xy.c index 98ebc1b..cebba95 100644 --- a/test/xy.c +++ b/test/xy.c @@ -13,11 +13,17 @@ #include "xy.h" void -print_str (void *str) +print_str_for_seq (void *str) { print ((char *) str); } +void +print_str_for_map (const char *key, void *value) +{ + println (xy_strcat (4, " ", key, " => ", (char *) value)); +} + int main (int argc, char const *argv[]) @@ -144,11 +150,23 @@ main (int argc, char const *argv[]) xy_seq_push (seq, "World"); assert_str ("Hello", xy_seq_at (seq, 1)); assert_str ("World", xy_seq_at (seq, 2)); - xy_seq_each (seq, print_str); + xy_seq_each (seq, print_str_for_seq); br(); xy_seq_pop (seq); assert (1 == xy_seq_len (seq)); + XyMap_t *map = xy_map_new (); + xy_map_set (map, "Hello", "World"); + xy_map_set (map, "你好", "世界"); + assert_str ("World", xy_map_get (map, "Hello")); + assert_str ("世界", xy_map_get (map, "你好")); + xy_map_set (map, "Hello", "chsrc"); + assert_str ("chsrc", xy_map_get (map, "Hello")); + assert (2 == xy_map_len (map)); + echo ("{"); + xy_map_each (map, print_str_for_map); + echo ("}"); + xy_succ ("测试完成", "xy.h 测试全部通过"); // xy_unimplemented(); From ef65acc5dfdcdd1946f4e3f1b207fe92caf9b6d8 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 16:42:04 +0800 Subject: [PATCH 041/103] =?UTF-8?q?=E8=BF=81=E7=A7=BB=20`xy=5Fstrjoin()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 40 ++++++++++++++++++++-------------------- test/xy.c | 10 +++++----- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index c05c09b..6f950ac 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -483,9 +483,9 @@ xy_str_to_quietcmd (const char *cmd) { char *ret = NULL; #ifdef _WIN32 - ret = xy_2strjoin (cmd, " >nul 2>nul "); + ret = xy_2strcat (cmd, " >nul 2>nul "); #else - ret = xy_2strjoin (cmd, " 1>/dev/null 2>&1 "); + ret = xy_2strcat (cmd, " 1>/dev/null 2>&1 "); #endif return ret; } @@ -638,24 +638,24 @@ _xy_log (int level, const char *prompt, const char *content) */ if (level & _XY_Log_Plain) { - str = xy_strjoin (3, prompt, ": ", content); + str = xy_strcat (3, prompt, ": ", content); } else if (level & _XY_Log_Success) { - str = xy_strjoin (3, prompt, ": ", xy_str_to_green (content)); + str = xy_strcat (3, prompt, ": ", xy_str_to_green (content)); } else if (level & _XY_Log_Info) { - str = xy_strjoin (3, prompt, ": ", xy_str_to_blue (content)); + str = xy_strcat (3, prompt, ": ", xy_str_to_blue (content)); } else if (level & _XY_Log_Warn) { - str = xy_strjoin (3, prompt, ": ", xy_str_to_yellow (content)); + str = xy_strcat (3, prompt, ": ", xy_str_to_yellow (content)); to_stderr = true; } else if (level & _XY_Log_Error) { - str = xy_strjoin (3, prompt, ": ", xy_str_to_red (content)); + str = xy_strcat (3, prompt, ": ", xy_str_to_red (content)); to_stderr = true; } else @@ -694,7 +694,7 @@ _xy_log (int level, const char *prompt, const char *content) static void xy_log_brkt_to (const char *prompt, const char *content, FILE *stream) { - char *str = xy_strjoin (4, "[", prompt, "] ", content); + char *str = xy_strcat (4, "[", prompt, "] ", content); fprintf (stream, "%s\n", str); free (str); } @@ -714,12 +714,12 @@ _xy_log_brkt (int level, const char *prompt1, const char *prompt2, const char *c if (level & _XY_Log_Plain) { - str = xy_strjoin (6, "[", prompt1, " ", prompt2, "] ", content); + str = xy_strcat (6, "[", prompt1, " ", prompt2, "] ", content); } else if (level & _XY_Log_Success) { /* [app 成功] [app success] */ - str = xy_strjoin (6, + str = xy_strcat (6, "[", xy_str_to_green (prompt1), " ", xy_str_to_bold (xy_str_to_green (prompt2)), "] ", xy_str_to_green (content)); } else if (level & _XY_Log_Info) @@ -727,20 +727,20 @@ _xy_log_brkt (int level, const char *prompt1, const char *prompt2, const char *c /* [app 信息] [app info] [app 提示] [app notice] */ - str = xy_strjoin (6, + str = xy_strcat (6, "[", xy_str_to_blue (prompt1), " ", xy_str_to_bold (xy_str_to_blue (prompt2)), "] ", xy_str_to_blue (content)); } else if (level & _XY_Log_Warn) { /* [app 警告] [app warn] */ - str = xy_strjoin (6, + str = xy_strcat (6, "[", xy_str_to_yellow (prompt1), " ", xy_str_to_bold (xy_str_to_yellow (prompt2)), "] ", xy_str_to_yellow (content)); to_stderr = true; } else if (level & _XY_Log_Error) { /* [app 错误] [app error] */ - str = xy_strjoin (6, + str = xy_strcat (6, "[", xy_str_to_red (prompt1), " ", xy_str_to_bold (xy_str_to_red (prompt2)), "] ", xy_str_to_red (content)); to_stderr = true; } @@ -892,7 +892,7 @@ _xy_win_documents () if (SUCCEEDED (result)) return xy_strdup (documents_path); - return xy_2strjoin (xy_os_home, "\\Documents"); + return xy_2strcat (xy_os_home, "\\Documents"); #else return NULL; #endif @@ -912,7 +912,7 @@ _xy_win_powershell_profile () if (xy_on_windows) { char *documents_dir = _xy_win_documents (); - char *profile_path = xy_2strjoin (documents_dir, "\\PowerShell\\Microsoft.PowerShell_profile.ps1"); + char *profile_path = xy_2strcat (documents_dir, "\\PowerShell\\Microsoft.PowerShell_profile.ps1"); free (documents_dir); return profile_path; } @@ -932,7 +932,7 @@ _xy_win_powershellv5_profile () if (xy_on_windows) { char *documents_dir = _xy_win_documents (); - char *profile_path = xy_2strjoin (documents_dir, "\\WindowsPowerShell\\Microsoft.PowerShell_profile.ps1"); + char *profile_path = xy_2strcat (documents_dir, "\\WindowsPowerShell\\Microsoft.PowerShell_profile.ps1"); free (documents_dir); return profile_path; } @@ -953,7 +953,7 @@ xy_file_exist (const char *path) const char *new_path = path; if (xy_str_start_with (path, "~")) { - new_path = xy_2strjoin (xy_os_home, path + 1); + new_path = xy_2strcat (xy_os_home, path + 1); } // 0 即 F_OK return (0==access (new_path, 0)) ? true : false; @@ -971,7 +971,7 @@ xy_dir_exist (const char *path) { if (xy_str_start_with (path, "~")) { - dir = xy_2strjoin (xy_os_home, path + 1); + dir = xy_2strcat (xy_os_home, path + 1); } } @@ -998,7 +998,7 @@ xy_dir_exist (const char *path) } else { - int status = system (xy_2strjoin ("test -d ", dir)); + int status = system (xy_2strcat ("test -d ", dir)); if (0==status) return true; @@ -1024,7 +1024,7 @@ xy_normalize_path (const char *path) if (xy_str_start_with (new, "~")) { - new = xy_2strjoin (xy_os_home, xy_str_delete_prefix (new, "~")); + new = xy_2strcat (xy_os_home, xy_str_delete_prefix (new, "~")); } if (xy_on_windows) diff --git a/test/xy.c b/test/xy.c index cebba95..57d63fc 100644 --- a/test/xy.c +++ b/test/xy.c @@ -35,11 +35,11 @@ main (int argc, char const *argv[]) println (3); double dbl = 3.1415; println (dbl); - say (xy_2strjoin ("Xi", "'an")); - say (xy_strjoin (2, "Xi", "'an")); - say (xy_strjoin (3, "屈身守分,", "以待天时,", "不可与命争也")); - say (xy_strjoin (4, "水落鱼梁浅,", "天寒梦泽深。", "羊公碑字在,", "读罢泪沾襟。")); - say (xy_strjoin (6, "楚山横地出,", "汉水接天回。", "冠盖非新里,", "章华即旧台。", "习池风景异,", "归路满尘埃。")); + say (xy_2strcat ("Xi", "'an")); + say (xy_strcat (2, "Xi", "'an")); + say (xy_strcat (3, "屈身守分,", "以待天时,", "不可与命争也")); + say (xy_strcat (4, "水落鱼梁浅,", "天寒梦泽深。", "羊公碑字在,", "读罢泪沾襟。")); + say (xy_strcat (6, "楚山横地出,", "汉水接天回。", "冠盖非新里,", "章华即旧台。", "习池风景异,", "归路满尘埃。")); print (xy_str_to_bold ("粗体")); print (xy_str_to_faint ("浅体")); From 1773745b76de1d126ee396870e2b9e37246fb3b2 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 16:59:16 +0800 Subject: [PATCH 042/103] =?UTF-8?q?=E4=B8=BA=20`Contributor=5Ft`=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20`id`=20=E5=92=8C=20`display=5Fname`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/struct.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/framework/struct.h b/src/framework/struct.h index 111d7af..031f1b5 100644 --- a/src/framework/struct.h +++ b/src/framework/struct.h @@ -7,7 +7,7 @@ * Contributors : Shengwei Chen <414685209@qq.com> * | * Created On : <2023-08-29> - * Last Modified : <2025-08-11> + * Last Modified : <2025-08-20> * * chsrc struct * ------------------------------------------------------------*/ @@ -109,8 +109,10 @@ Capability_t; typedef struct Contributor_t { - char *name; + char *id; /* 全局唯一贡献者标识符,防止反复写信息,以 @ 开头 */ + char *name; /* 贡献者姓名; 鉴于该项目完全依赖于贡献者,建议留下真实姓名或者昵称 */ char *email; + char *display_name; /* recipe 结束时会显示贡献者信息,如果你不愿显示真实姓名或者昵称,可以另外提供一个名字 */ } Contributor_t; From 6496ff0b9e6c650de18af02ce4cb9f781b5cbb84 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 17:01:01 +0800 Subject: [PATCH 043/103] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20`chsrc=5Fframework?= =?UTF-8?q?=5Fprelude()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chsrc-main.c | 5 ++++- src/framework/core.c | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index f6ed771..446e803 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -688,10 +688,13 @@ get_target (const char *input, TargetOp code, char *option) } + int main (int argc, char const *argv[]) { - xy_useutf8 (); argc -= 1; + chsrc_framework_prelude (); + + argc -= 1; if (0==argc) { diff --git a/src/framework/core.c b/src/framework/core.c index fb7ec9a..70ae3b6 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -122,6 +122,8 @@ typedef enum ChgType_t /* Global Program Status */ struct { + XyMap_t *contributors; /* 所有贡献者 */ + int leader_selected_index; /* leader target 选中的索引 */ ChgType_t chgtype; /* 换源实现的类型 */ @@ -130,6 +132,7 @@ struct } ProgStatus = { + .contributors = NULL, .leader_selected_index = -1, .chgtype = ChgType_Auto, .chsrc_run_faas = false @@ -205,6 +208,17 @@ chsrc_alert2 (const char *str) } + +void +chsrc_framework_prelude () +{ + xy_useutf8 (); + + ProgStatus.contributors = xy_map_new (); +} + + + void chsrc_log_write (const char *filename) { From f4718a05fdf3c85d6c539dcdcd764fb61b2b79df Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 18:12:23 +0800 Subject: [PATCH 044/103] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20`chef=5Fregister?= =?UTF-8?q?=5Fcontributor()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/chef.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/framework/chef.c b/src/framework/chef.c index 991ac0c..63b64c5 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -2,10 +2,10 @@ * SPDX-License-Identifier: GPL-3.0-or-later * ------------------------------------------------------------- * File Name : chef.c - * File Authors : Aoran Zeng - * Contributors : Nul None + * File Authors : 曾奥然 + * Contributors : Nul None * Created On : <2025-08-09> - * Last Modified : <2025-08-11> + * Last Modified : <2025-08-20> * * chef DSL: for chefs (recipe makers) to define a target * ------------------------------------------------------------*/ @@ -17,6 +17,31 @@ #define chef_allow_sr(t) this->getfn = NULL; this->setfn = t##_setsrc; this->resetfn = t##_resetsrc; #define chef_allow_gs(t) this->getfn = t##_getsrc; this->setfn = t##_setsrc; this->resetfn = NULL; +/** + * @brief 登记所有贡献者 + * + * @param id 贡献者 ID,这个ID最好是GitHub用户名,但也可以不是,只需要在 chsrc 内部进行区分即可 + * @param display_name 如果没有提供该参数,则使用 name + */ +void +chef_register_contributor (char *id, char *name, char *email, char *display_name) +{ + if (!id || !name || !email) + xy_unreached(); + + Contributor_t *contributor = xy_malloc0 (sizeof (Contributor_t)); + contributor->id = xy_strdup (id); + contributor->name = xy_strdup (name); + contributor->email = xy_strdup (email); + + if (!display_name) + contributor->display_name = xy_strdup (name); + else + contributor->display_name = xy_strdup (display_name); + + xy_map_set (ProgStatus.contributors, id, contributor); +} + /** * @brief 修改 Provider 的测速地址 From 81b9c2911a54ebd76f158fff049049607eb0d9c6 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 18:13:25 +0800 Subject: [PATCH 045/103] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20`chsrc=5Fregister?= =?UTF-8?q?=5Fcontributors()`=20=E5=B9=B6=E5=B0=86=E5=A4=A7=E9=83=A8?= =?UTF-8?q?=E5=88=86=20`#include`=20=E6=94=BE=E4=BA=8E=20`menu.c`=20?= =?UTF-8?q?=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chsrc-main.c | 169 +++++++++++----------------------------------- src/recipe/menu.c | 102 +++++++++++++++++++++++++++- 2 files changed, 140 insertions(+), 131 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 446e803..94f5a15 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -1,42 +1,15 @@ /** ------------------------------------------------------------ - * Copyright © 2023-2025 Aoran Zeng, Heng Guo + * Copyright © 2023-2025 曾奥然, 郭恒 * SPDX-License-Identifier: GPL-3.0-or-later * ------------------------------------------------------------- - * Project Name : chsrc - * Project Authors : Aoran Zeng - * | Heng Guo <2085471348@qq.com> - * Contributors : Aaron Ruan - * | Rui Chen - * | Shengwei Chen <414685209@qq.com> - * | BlockLune - * | Mr. Will - * | Terrasse - * | Lontten - * | happy game - * | Word2VecT - * | xuan - * | GnixAij - * | ChatGPT - * | czyt - * | zouri - * | yongxiang <1926885268@qq.com> - * | YU-7 <2747046473@qq.com> - * | juzeon - * | Jialin Lyu - * | GitHub Copilot - * | ccy - * | MadDogOwner - * | sanchuanhehe - * | Mikachu2333 - * | Rui Yang - * | BingChunMoLi - * | - * Created On : <2023-08-28> - * Last Modified : See * - * chsrc: Change Source —— 全平台通用命令行换源工具 + * chsrc: Change Source + * + * 全平台通用换源工具与框架 + * * ------------------------------------------------------------*/ +#define Chsrc_Initial_Date "2023-08-28" #define Chsrc_Version "0.2.2.3" #define Chsrc_Release_Date "2025/08/11" #define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc" @@ -45,101 +18,39 @@ #include "framework/core.c" #include "framework/chef.c" - -#include "recipe/lang/rawstr4c.h" - -#include "recipe/lang/Ruby/Ruby.c" -#include "recipe/lang/Python/common.h" - #include "recipe/lang/Python/pip.c" - #include "recipe/lang/Python/Poetry.c" - #include "recipe/lang/Python/PDM.c" - #include "recipe/lang/Python/Rye.c" - #include "recipe/lang/Python/uv.c" -#include "recipe/lang/Python/Python.c" - -#include "recipe/lang/JavaScript/common.h" - #include "recipe/lang/JavaScript/npm.c" - #include "recipe/lang/JavaScript/pnpm.c" - #include "recipe/lang/JavaScript/Yarn.c" -#include "recipe/lang/JavaScript/JavaScript.c" -#include "recipe/lang/JavaScript/Bun.c" -#include "recipe/lang/JavaScript/nvm.c" - -#include "recipe/lang/Perl.c" -#include "recipe/lang/PHP.c" -#include "recipe/lang/Lua.c" -#include "recipe/lang/Go.c" -#include "recipe/lang/Java.c" - -#include "recipe/lang/Rust/common.h" - #include "recipe/lang/Rust/rustup.c" - #include "recipe/lang/Rust/Cargo.c" - -#include "recipe/lang/Dart/common.h" -#include "recipe/lang/Dart/Pub.c" -#include "recipe/lang/Dart/Flutter.c" - -#include "recipe/lang/Haskell.c" -#include "recipe/lang/OCaml.c" -#include "recipe/lang/R.c" -#include "recipe/lang/Julia.c" -#include "recipe/lang/NuGet.c" -#include "recipe/lang/Clojure.c" - - -#include "recipe/os/rawstr4c.h" -#include "recipe/os/APT/common.h" -// Debian-based -#include "recipe/os/APT/Debian.c" -#include "recipe/os/APT/Ubuntu.c" -#include "recipe/os/APT/Kali-Linux.c" -#include "recipe/os/APT/Raspberry-Pi-OS.c" -// Ubuntu-based -#include "recipe/os/APT/Linux-Mint.c" -#include "recipe/os/APT/Trisquel.c" -#include "recipe/os/APT/Linux-Lite.c" -// Debian-based and Ubuntu-based -#include "recipe/os/APT/Armbian.c" -// Independent -#include "recipe/os/APT/ROS.c" -#include "recipe/os/APT/Termux.c" -#include "recipe/os/APT/openKylin.c" -#include "recipe/os/APT/deepin.c" - -#include "recipe/os/YUM/common.h" -#include "recipe/os/YUM/Fedora-Linux.c" -#include "recipe/os/YUM/AlmaLinux.c" -#include "recipe/os/YUM/Rocky-Linux.c" -#include "recipe/os/YUM/openEuler.c" -#include "recipe/os/YUM/Anolis-OS.c" - -#include "recipe/os/pacman/Arch-Linux.c" -#include "recipe/os/pacman/Manjaro-Linux.c" -#include "recipe/os/pacman/MSYS2.c" - -#include "recipe/os/openSUSE.c" -#include "recipe/os/Alpine-Linux.c" -#include "recipe/os/Gentoo-Linux.c" -#include "recipe/os/Void-Linux.c" -#include "recipe/os/Solus.c" -#include "recipe/os/OpenWrt.c" - -#include "recipe/os/BSD/FreeBSD.c" -#include "recipe/os/BSD/NetBSD.c" -#include "recipe/os/BSD/OpenBSD.c" - - -#include "recipe/ware/TeX-Live.c" -#include "recipe/ware/Emacs.c" -#include "recipe/ware/WinGet.c" -#include "recipe/ware/Homebrew/Homebrew.c" -#include "recipe/ware/CocoaPods.c" -#include "recipe/ware/Nix.c" -#include "recipe/ware/Guix.c" -#include "recipe/ware/Flatpak.c" -#include "recipe/ware/Docker/Docker.c" -#include "recipe/ware/Anaconda/Anaconda.c" - +void +chsrc_register_contributors () +{ + /* 项目创建者 */ + chef_register_contributor ("@ccmywish", "曾奥然", "ccmywish@qq.com", NULL); + chef_register_contributor ("@G_I_Y", "郭恒", "2085471348@qq.com", NULL); + /* 所有贡献者 (按参与贡献时间排序) */ + chef_register_contributor ("@Aaron-212", "Aaron Ruan", "aaron212cn@outlook.com", NULL); + chef_register_contributor ("@chenrui333", "Rui Chen", "rui@chenrui.dev", NULL); + chef_register_contributor ("@livelycode36", "Shengwei Chen", "414685209@qq.com", NULL); + chef_register_contributor ("@BlockLune", "BlockLune", "blocklune@gmail.com", NULL); + chef_register_contributor ("@MrWillCom", "Mr. Will", "mr.will.com@outlook.com", NULL); + chef_register_contributor ("@Jerry-Terrasse", "Terrasse", "terrasse@qq.com", NULL); + chef_register_contributor ("@lontten", "Lontten", "lontten@163.com", NULL); + chef_register_contributor ("@happy-game", "Happy Game", "happygame1024@gmail.com", NULL); + chef_register_contributor ("@Word2VecT", "Word2VecT", "tangzinan@bupt.edu.cn", NULL); + chef_register_contributor ("@wickdynex", "Xuan", "wick.dynex@qq.com", NULL); + chef_register_contributor ("@Efterklang", "GnixAij", "gaojiaxing0220@gmail.com", NULL); + chef_register_contributor ("@ChatGPT", "ChatGPT", "chatgpt.com", NULL); + chef_register_contributor ("@czyt", "czyt", "czyt.go@gmail.com", NULL); + chef_register_contributor ("@zouri", "Zouri", "guoshuaisun@outlook.com", NULL); + chef_register_contributor ("@xyx1926885268", "Yongxiang", "1926885268@qq.com", NULL); + chef_register_contributor ("@YU-7", "YU-7", "2747046473@qq.com", NULL); + chef_register_contributor ("@juzeon", "juzeon", "skyjuzheng@gmail.com", NULL); + chef_register_contributor ("@jialinlvcn", "Jialin Lyu", "jialinlvcn@aliyun.com", NULL); + chef_register_contributor ("@GitHub Copilot", "GitHub Copilot", "github.com/copilot", NULL); + chef_register_contributor ("@Kattos", "ccy", "icuichengyi@gmail.com", NULL); + chef_register_contributor ("@xrgzs", "MadDogOwner", "xiaoran@xrgzs.top", NULL); + chef_register_contributor ("@sanchuanhehe", "sanchuanhehe", "wyihe5520@gmail.com", NULL); + chef_register_contributor ("@Mikachu2333", "Mikachu2333", "mikachu.23333@zohomail.com", NULL); + chef_register_contributor ("@techoc", "Rui Yang", "techoc@foxmail.com", NULL); + chef_register_contributor ("@BingChunMoLi", "BingChunMoLi", "bingchunmoli@bingchunmoli.com", NULL); +} #include "recipe/menu.c" @@ -611,6 +522,8 @@ get_target (const char *input, TargetOp code, char *option) if (!matched) return false; + chsrc_register_contributors (); + if (TargetOp_Set_Source==code) { if (target->setfn) diff --git a/src/recipe/menu.c b/src/recipe/menu.c index d96250c..7491080 100644 --- a/src/recipe/menu.c +++ b/src/recipe/menu.c @@ -1,14 +1,110 @@ /** ------------------------------------------------------------ * SPDX-License-Identifier: GPL-3.0-or-later * ------------------------------------------------------------- - * File Authors : Aoran Zeng + * File Authors : 曾奥然 * Contributors : Mikachu2333 * | * Created On : <2023-09-01> - * Major Revision : 3 - * Last Modified : <2025-08-10> + * Major Revision : 4 + * Last Modified : <2025-08-20> * ------------------------------------------------------------*/ +#include "lang/rawstr4c.h" + +#include "lang/Ruby/Ruby.c" +#include "lang/Python/common.h" + #include "lang/Python/pip.c" + #include "lang/Python/Poetry.c" + #include "lang/Python/PDM.c" + #include "lang/Python/Rye.c" + #include "lang/Python/uv.c" +#include "lang/Python/Python.c" + +#include "lang/JavaScript/common.h" + #include "lang/JavaScript/npm.c" + #include "lang/JavaScript/pnpm.c" + #include "lang/JavaScript/Yarn.c" +#include "lang/JavaScript/JavaScript.c" +#include "lang/JavaScript/Bun.c" +#include "lang/JavaScript/nvm.c" + +#include "lang/Perl.c" +#include "lang/PHP.c" +#include "lang/Lua.c" +#include "lang/Go.c" +#include "lang/Java.c" + +#include "lang/Rust/common.h" + #include "lang/Rust/rustup.c" + #include "lang/Rust/Cargo.c" + +#include "lang/Dart/common.h" +#include "lang/Dart/Pub.c" +#include "lang/Dart/Flutter.c" + +#include "lang/Haskell.c" +#include "lang/OCaml.c" +#include "lang/R.c" +#include "lang/Julia.c" +#include "lang/NuGet.c" +#include "lang/Clojure.c" + + +#include "os/rawstr4c.h" +#include "os/APT/common.h" +// Debian-based +#include "os/APT/Debian.c" +#include "os/APT/Ubuntu.c" +#include "os/APT/Kali-Linux.c" +#include "os/APT/Raspberry-Pi-OS.c" +// Ubuntu-based +#include "os/APT/Linux-Mint.c" +#include "os/APT/Trisquel.c" +#include "os/APT/Linux-Lite.c" +// Debian-based and Ubuntu-based +#include "os/APT/Armbian.c" +// Independent +#include "os/APT/ROS.c" +#include "os/APT/Termux.c" +#include "os/APT/openKylin.c" +#include "os/APT/deepin.c" + +#include "os/YUM/common.h" +#include "os/YUM/Fedora-Linux.c" +#include "os/YUM/AlmaLinux.c" +#include "os/YUM/Rocky-Linux.c" +#include "os/YUM/openEuler.c" +#include "os/YUM/Anolis-OS.c" + +#include "os/pacman/Arch-Linux.c" +#include "os/pacman/Manjaro-Linux.c" +#include "os/pacman/MSYS2.c" + +#include "os/openSUSE.c" +#include "os/Alpine-Linux.c" +#include "os/Gentoo-Linux.c" +#include "os/Void-Linux.c" +#include "os/Solus.c" +#include "os/OpenWrt.c" + +#include "os/BSD/FreeBSD.c" +#include "os/BSD/NetBSD.c" +#include "os/BSD/OpenBSD.c" + + +#include "ware/TeX-Live.c" +#include "ware/Emacs.c" +#include "ware/WinGet.c" +#include "ware/Homebrew/Homebrew.c" +#include "ware/CocoaPods.c" +#include "ware/Nix.c" +#include "ware/Guix.c" +#include "ware/Flatpak.c" +#include "ware/Docker/Docker.c" +#include "ware/Anaconda/Anaconda.c" + + + #define t(o) &o##_target, &o##_prelude TargetRegisterInfo_t From 63b3832ce9d4245f2103073749b9919d505718d7 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 18:19:58 +0800 Subject: [PATCH 046/103] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=E4=B8=BA=20?= =?UTF-8?q?`xy=5Fuse=5Futf8()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 11 +++++------ src/framework/core.c | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index 6f950ac..387eec7 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -2,7 +2,6 @@ * Copyright © 2023-2025 Aoran Zeng, Heng Guo * SPDX-License-Identifier: MIT * ------------------------------------------------------------- - * Lib Name : xy.h * Lib Authors : 曾奥然 * | 郭恒 <2085471348@qq.com> * Contributors : juzeon @@ -23,7 +22,7 @@ #ifndef XY_H #define XY_H -#define _XY_Version "v0.1.6.0-2025/08/18" +#define _XY_Version "v0.1.7.0-2025/08/20" #define _XY_Maintain_URL "https://github.com/RubyMetric/chsrc/blob/dev/lib/xy.h" #define _XY_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc/blob/dev/lib/xy.h" @@ -71,7 +70,7 @@ bool xy_enable_color = true; #define xy_os_devnull "nul" #include #include - #define xy_useutf8() SetConsoleOutputCP (65001) + #define xy_use_utf8() SetConsoleOutputCP (65001) #elif defined(__linux__) || defined(__linux) #define XY_On_Linux 1 @@ -80,7 +79,7 @@ bool xy_enable_color = true; #define xy_on_macos false #define xy_on_bsd false #define xy_os_devnull "/dev/null" - #define xy_useutf8() + #define xy_use_utf8() #elif defined(__APPLE__) #define XY_On_macOS 1 @@ -89,7 +88,7 @@ bool xy_enable_color = true; #define xy_on_macos true #define xy_on_bsd false #define xy_os_devnull "/dev/null" - #define xy_useutf8() + #define xy_use_utf8() #elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) #define XY_On_BSD 1 @@ -98,7 +97,7 @@ bool xy_enable_color = true; #define xy_on_macos false #define xy_on_bsd true #define xy_os_devnull "/dev/null" - #define xy_useutf8() + #define xy_use_utf8() #endif #define assert_str(a, b) assert (xy_streql ((a), (b))) diff --git a/src/framework/core.c b/src/framework/core.c index 70ae3b6..0443afb 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -2,14 +2,14 @@ * SPDX-License-Identifier: GPL-3.0-or-later * ------------------------------------------------------------- * File Name : core.c - * File Authors : Aoran Zeng - * | Heng Guo <2085471348@qq.com> + * File Authors : 曾奥然 + * | 郭恒 <2085471348@qq.com> * Contributors : Peng Gao * | Happy Game * | Yangmoooo * | * Created On : <2023-08-29> - * Last Modified : <2025-08-10> + * Last Modified : <2025-08-20> * * chsrc framework * ------------------------------------------------------------*/ @@ -212,7 +212,7 @@ chsrc_alert2 (const char *str) void chsrc_framework_prelude () { - xy_useutf8 (); + xy_use_utf8 (); ProgStatus.contributors = xy_map_new (); } From aabec77833620696d94d105a655c881e9e2dbd77 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 18:27:04 +0800 Subject: [PATCH 047/103] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B4=A1=E7=8C=AE?= =?UTF-8?q?=E8=80=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chsrc-main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 94f5a15..1da4ce2 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -10,8 +10,8 @@ * ------------------------------------------------------------*/ #define Chsrc_Initial_Date "2023-08-28" -#define Chsrc_Version "0.2.2.3" -#define Chsrc_Release_Date "2025/08/11" +#define Chsrc_Version "0.2.2.3-dev5" +#define Chsrc_Release_Date "2025/08/20" #define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc" #define Chsrc_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc" @@ -28,6 +28,7 @@ chsrc_register_contributors () chef_register_contributor ("@Aaron-212", "Aaron Ruan", "aaron212cn@outlook.com", NULL); chef_register_contributor ("@chenrui333", "Rui Chen", "rui@chenrui.dev", NULL); chef_register_contributor ("@livelycode36", "Shengwei Chen", "414685209@qq.com", NULL); + chef_register_contributor ("@Gn3po4g", "Peng Gao", "gn3po4g@outlook.com", NULL); chef_register_contributor ("@BlockLune", "BlockLune", "blocklune@gmail.com", NULL); chef_register_contributor ("@MrWillCom", "Mr. Will", "mr.will.com@outlook.com", NULL); chef_register_contributor ("@Jerry-Terrasse", "Terrasse", "terrasse@qq.com", NULL); From 0d232fba92ae46d5748ac27c0c2a1ed68a7e4449 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 18:32:30 +0800 Subject: [PATCH 048/103] =?UTF-8?q?=E5=85=A8=E9=83=A8=E4=BD=BF=E7=94=A8=20?= =?UTF-8?q?`xy=5Fstrcat()`=20=E5=BC=83=E7=94=A8=20`xy=5Fstrjoin()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 5 -- src/chsrc-main.c | 24 +++--- src/framework/chef-helper.c | 8 +- src/framework/chef.c | 6 +- src/framework/core.c | 124 ++++++++++++++-------------- src/recipe/lang/Dart/Flutter.c | 4 +- src/recipe/lang/Dart/Pub.c | 4 +- src/recipe/lang/Go.c | 2 +- src/recipe/lang/Haskell.c | 4 +- src/recipe/lang/Java.c | 6 +- src/recipe/lang/JavaScript/Bun.c | 2 +- src/recipe/lang/JavaScript/Yarn.c | 6 +- src/recipe/lang/JavaScript/npm.c | 4 +- src/recipe/lang/JavaScript/nvm.c | 2 +- src/recipe/lang/JavaScript/pnpm.c | 4 +- src/recipe/lang/Julia.c | 2 +- src/recipe/lang/Lua.c | 4 +- src/recipe/lang/OCaml.c | 4 +- src/recipe/lang/PHP.c | 2 +- src/recipe/lang/Perl.c | 2 +- src/recipe/lang/Python/PDM.c | 4 +- src/recipe/lang/Python/Poetry.c | 2 +- src/recipe/lang/Python/Rye.c | 4 +- src/recipe/lang/Python/common.h | 2 +- src/recipe/lang/Python/pip.c | 4 +- src/recipe/lang/Python/uv.c | 8 +- src/recipe/lang/R.c | 8 +- src/recipe/lang/Ruby/Ruby.c | 6 +- src/recipe/lang/Rust/Cargo.c | 2 +- src/recipe/lang/Rust/rustup.c | 18 ++-- src/recipe/os/APT/Armbian.c | 2 +- src/recipe/os/APT/Debian.c | 8 +- src/recipe/os/APT/Kali-Linux.c | 2 +- src/recipe/os/APT/Linux-Lite.c | 2 +- src/recipe/os/APT/Linux-Mint.c | 2 +- src/recipe/os/APT/ROS.c | 2 +- src/recipe/os/APT/Raspberry-Pi-OS.c | 2 +- src/recipe/os/APT/Termux.c | 2 +- src/recipe/os/APT/Trisquel.c | 2 +- src/recipe/os/APT/Ubuntu.c | 8 +- src/recipe/os/APT/deepin.c | 2 +- src/recipe/os/APT/openKylin.c | 2 +- src/recipe/os/Alpine-Linux.c | 2 +- src/recipe/os/BSD/FreeBSD.c | 16 ++-- src/recipe/os/BSD/NetBSD.c | 2 +- src/recipe/os/Gentoo-Linux.c | 4 +- src/recipe/os/OpenWrt.c | 2 +- src/recipe/os/Solus.c | 2 +- src/recipe/os/Void-Linux.c | 4 +- src/recipe/os/YUM/AlmaLinux.c | 2 +- src/recipe/os/YUM/Anolis-OS.c | 2 +- src/recipe/os/YUM/Fedora-Linux.c | 4 +- src/recipe/os/YUM/Rocky-Linux.c | 4 +- src/recipe/os/YUM/openEuler.c | 2 +- src/recipe/os/pacman/Arch-Linux.c | 8 +- src/recipe/os/pacman/MSYS2.c | 4 +- src/recipe/ware/Anaconda/Anaconda.c | 4 +- src/recipe/ware/CocoaPods.c | 4 +- src/recipe/ware/Docker/Docker.c | 2 +- src/recipe/ware/Flatpak.c | 4 +- src/recipe/ware/Guix.c | 2 +- src/recipe/ware/Nix.c | 8 +- src/recipe/ware/TeX-Live.c | 6 +- src/recipe/ware/WinGet.c | 2 +- test/fw.c | 2 +- 65 files changed, 200 insertions(+), 205 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index 387eec7..e02dabf 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -264,8 +264,6 @@ xy_2strcat (const char *str1, const char *str2) return ret; } -/* @deprecated 应迁移到后者 */ -#define xy_2strjoin xy_2strcat /** * @brief 将多个字符串连接成一个字符串 @@ -336,9 +334,6 @@ xy_strcat (unsigned int count, ...) return ret; } -/* @deprecated 应迁移到后者 */ -#define xy_strjoin xy_strcat - /** * @brief 复制一个字符串,返回复制的新字符串 diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 1da4ce2..01b0f57 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -64,7 +64,7 @@ cli_print_available_mirrors () { { char *msg = ENGLISH ? "To specify a source, use chsrc set " : "指定使用某源,请使用 chsrc set "; - say (bdblue(xy_strjoin (3, msg, "", " \n"))); + say (bdblue(xy_strcat (3, msg, "", " \n"))); } { @@ -246,28 +246,28 @@ cli_print_target_features (Target_t *target, const char *input_target_name) { char *msg = ENGLISH ? " Get: View the current source state " : " Get: 查看当前源状态 "; - char *get_msg = xy_strjoin (3, msg, "| chsrc get ", input_target_name); + char *get_msg = xy_strcat (3, msg, "| chsrc get ", input_target_name); if (target->getfn != NULL) printf (" %s%s\n", bdgreen(YesMark), purple(get_msg)); else printf (" %s%s\n", bdred(NoMark), get_msg);br(); } { char *msg = ENGLISH ? " Reset: Reset to the default source " : " Reset: 重置回默认源 "; - char *reset_msg = xy_strjoin (3, msg, "| chsrc reset ", input_target_name); + char *reset_msg = xy_strcat (3, msg, "| chsrc reset ", input_target_name); if (target->resetfn != NULL) printf (" %s%s\n", bdgreen(YesMark), purple(reset_msg)); else printf (" %s%s\n", bdred(NoMark), reset_msg);br(); } { char *msg = ENGLISH ? " UserDefine: using user-defined source URL " : " UserDefine: 用户自定义换源URL "; - char *user_define_msg = xy_strjoin (5, msg, "| chsrc set ", input_target_name, " https://user-define-url.org/", input_target_name); + char *user_define_msg = xy_strcat (5, msg, "| chsrc set ", input_target_name, " https://user-define-url.org/", input_target_name); if (target->can_user_define) printf (" %s%s\n", bdgreen(YesMark), purple(user_define_msg)); else printf (" %s%s\n", bdred(NoMark), user_define_msg);br(); } { char *msg = ENGLISH ? " Locally: Change source only for this project " : " Locally: 仅对本项目换源 "; - char *locally_msg = xy_strjoin (3, msg, "| chsrc set -local ", input_target_name); + char *locally_msg = xy_strcat (3, msg, "| chsrc set -local ", input_target_name); switch (target->cap_local) { @@ -288,7 +288,7 @@ cli_print_target_features (Target_t *target, const char *input_target_name) { char *msg = ENGLISH ? " English: Output in English " : " English: 英文输出 "; - char *english_msg = xy_strjoin (3, msg, "| chsrc set -en ", input_target_name); + char *english_msg = xy_strcat (3, msg, "| chsrc set -en ", input_target_name); if (target->can_english) printf (" %s%s\n", bdgreen(YesMark), purple(english_msg)); else printf (" %s%s\n", bdred(NoMark), english_msg);br(); } @@ -531,7 +531,7 @@ get_target (const char *input, TargetOp code, char *option) { target->setfn(option); } - else chsrc_error (xy_strjoin (3, "暂未对 ", input, " 实现 set 功能,邀您帮助: chsrc issue")); + else chsrc_error (xy_strcat (3, "暂未对 ", input, " 实现 set 功能,邀您帮助: chsrc issue")); } else if (TargetOp_Reset_Source==code) { @@ -539,7 +539,7 @@ get_target (const char *input, TargetOp code, char *option) { target->resetfn(option); } - else chsrc_error (xy_strjoin (3, "暂未对 ", input, " 实现 reset 功能,邀您帮助: chsrc issue")); + else chsrc_error (xy_strcat (3, "暂未对 ", input, " 实现 reset 功能,邀您帮助: chsrc issue")); } else if (TargetOp_Get_Source==code) { @@ -547,13 +547,13 @@ get_target (const char *input, TargetOp code, char *option) { target->getfn(""); } - else chsrc_error (xy_strjoin (3, "暂未对 ", input, " 实现 get 功能,邀您帮助: chsrc issue")); + else chsrc_error (xy_strcat (3, "暂未对 ", input, " 实现 get 功能,邀您帮助: chsrc issue")); } else if (TargetOp_List_Config==code) { { char *msg = ENGLISH ? "To specify a source, use chsrc set " : "指定使用某源,请使用 chsrc set "; - say (bdblue(xy_strjoin (3, msg, input, " \n"))); + say (bdblue(xy_strcat (3, msg, input, " \n"))); } { @@ -677,7 +677,7 @@ main (int argc, char const *argv[]) else { char *msg = ENGLISH ? "Unknown option: " : "未识别的命令行选项 "; - chsrc_error (xy_2strjoin (msg, argv[i])); return Exit_Unknown; + chsrc_error (xy_2strcat (msg, argv[i])); return Exit_Unknown; } cli_arg_Target_pos++; cli_arg_Mirror_pos++; @@ -860,7 +860,7 @@ main (int argc, char const *argv[]) { char *msg1 = ENGLISH ? "Unknown command `" : "不支持的命令 "; char *msg2 = ENGLISH ? "`. Use `chsrc help` to view usage" : ". 请使用 chsrc help 查看使用方式"; - chsrc_error (xy_strjoin (3, msg1, command, msg2)); + chsrc_error (xy_strcat (3, msg1, command, msg2)); return Exit_Unknown; } diff --git a/src/framework/chef-helper.c b/src/framework/chef-helper.c index 9113f7b..c513aa1 100644 --- a/src/framework/chef-helper.c +++ b/src/framework/chef-helper.c @@ -2,10 +2,10 @@ * SPDX-License-Identifier: GPL-3.0-or-later * ------------------------------------------------------------- * File Name : chef-helper.c - * File Authors : Aoran Zeng - * Contributors : Nul None + * File Authors : 曾奥然 + * Contributors : Nul None * Created On : <2025-07-14> - * Last Modified : <2025-08-09> + * Last Modified : <2025-08-20> * * For chefs (recipe makers) and sometimes framewoker * to do some work not releated to OS operations @@ -40,5 +40,5 @@ chef_ensure_trailing_slash (char *str) if (len == 0 || str[len - 1] == '/') return xy_strdup (str); - return xy_2strjoin (str, "/"); + return xy_2strcat (str, "/"); } diff --git a/src/framework/chef.c b/src/framework/chef.c index 63b64c5..66dd96f 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -51,7 +51,7 @@ chef_set_provider_speed_measure_url (SourceProvider_t *provider, char *url) { provider->psmi.skip = NotSkip; provider->psmi.url = xy_strdup (url); - chsrc_debug ("m", xy_strjoin (4, "recipe 重新为 ", provider->code, " 设置测速链接: ", url)); + chsrc_debug ("m", xy_strcat (4, "recipe 重新为 ", provider->code, " 设置测速链接: ", url)); } @@ -62,7 +62,7 @@ void chef_set_provider_speed_measure_accuracy (SourceProvider_t *provider, bool accuracy) { provider->psmi.accurate = accuracy; - chsrc_debug ("m", xy_strjoin (4, "recipe 重新为 ", provider->code, " 设置测速精度: ", accuracy ? "精准" : "粗略")); + chsrc_debug ("m", xy_strcat (4, "recipe 重新为 ", provider->code, " 设置测速精度: ", accuracy ? "精准" : "粗略")); } @@ -99,7 +99,7 @@ chef_set_sources_speed_measure_url_with_func ( void chef_set_sources_speed_measure_url_with_postfix (Target_t *target, char *postfix) { - chef_set_sources_speed_measure_url_with_func (target, xy_2strjoin, postfix); + chef_set_sources_speed_measure_url_with_func (target, xy_2strcat, postfix); } diff --git a/src/framework/core.c b/src/framework/core.c index 0443afb..dcfae7c 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -232,8 +232,8 @@ chsrc_log_backup (const char *filename) { char *msg = ENGLISH ? "BACKUP" : "备份"; - char *bak = xy_2strjoin (filename, ".bak"); - xy_log_brkt (blue(App_Name), bdblue(msg), xy_strjoin (3, bdyellow(filename), " -> ", bdgreen(bak))); + char *bak = xy_2strcat (filename, ".bak"); + xy_log_brkt (blue(App_Name), bdblue(msg), xy_strcat (3, bdyellow(filename), " -> ", bdgreen(bak))); } #define YesMark "✓" @@ -264,12 +264,12 @@ log_check_result (const char *check_what, const char *check_type, bool exist) if (!exist) { - xy_log_brkt (App_Name, bdred (chk_msg), xy_strjoin (5, + xy_log_brkt (App_Name, bdred (chk_msg), xy_strcat (5, red (NoMark " "), check_type, " ", red (check_what), not_exist_msg)); } else { - xy_log_brkt (App_Name, bdgreen (chk_msg), xy_strjoin (5, + xy_log_brkt (App_Name, bdgreen (chk_msg), xy_strcat (5, green (YesMark " "), check_type, " ", green (check_what), exist_msg)); } } @@ -301,7 +301,7 @@ log_cmd_result (bool result, int exit_status) { char buf[8] = {0}; sprintf (buf, "%d", exit_status); - char *log = xy_2strjoin (red (fail_msg), bdred (buf)); + char *log = xy_2strcat (red (fail_msg), bdred (buf)); xy_log_brkt (red (App_Name), bdred (run_msg), log); } } @@ -338,7 +338,7 @@ query_program_exist (char *check_cmd, char *prog_name, int mode) { if (mode & Noisy_When_NonExist) { - // xy_warn (xy_strjoin(4, "× 命令 ", progname, " 不存在,", buf)); + // xy_warn (xy_strcat(4, "× 命令 ", progname, " 不存在,", buf)); log_check_result (prog_name, msg, false); } return false; @@ -364,7 +364,7 @@ cmd_to_check_program (char *prog_name) { char *check_tool = xy_on_windows ? "where " : "command -v "; - char *quiet_cmd = xy_str_to_quietcmd (xy_2strjoin (check_tool, prog_name)); + char *quiet_cmd = xy_str_to_quietcmd (xy_2strcat (check_tool, prog_name)); return quiet_cmd; } @@ -383,7 +383,7 @@ XY_Deprecate_This("Use cmd_to_check_program() instead") static char * cmd_to_check_program2 (char *prog_name) { - char *quiet_cmd = xy_str_to_quietcmd (xy_2strjoin (prog_name, " --version")); + char *quiet_cmd = xy_str_to_quietcmd (xy_2strcat (prog_name, " --version")); return quiet_cmd; } @@ -448,7 +448,7 @@ chsrc_ensure_program (char *prog_name) { char *msg1 = ENGLISH ? "not found " : "未找到 "; char *msg2 = ENGLISH ? " command, please check for existence" : " 命令,请检查是否存在"; - chsrc_error (xy_strjoin (3, msg1, prog_name, msg2)); + chsrc_error (xy_strcat (3, msg1, prog_name, msg2)); exit (Exit_UserCause); } } @@ -493,7 +493,7 @@ query_mirror_exist (Source_t *sources, size_t size, char *target_name, char *inp { char *msg1 = ENGLISH ? "Currently " : "当前 "; char *msg2 = ENGLISH ? " doesn't have any source available. Please contact the maintainers" : " 无任何可用源,请联系维护者"; - chsrc_error (xy_strjoin (3, msg1, target_name, msg2)); + chsrc_error (xy_strcat (3, msg1, target_name, msg2)); exit (Exit_MaintainerCause); } @@ -501,7 +501,7 @@ query_mirror_exist (Source_t *sources, size_t size, char *target_name, char *inp { char *msg1 = ENGLISH ? "Currently " : "当前 "; char *msg2 = ENGLISH ? " only the upstream source exists. Please contact the maintainers" : " 仅存在上游默认源,请联系维护者"; - chsrc_error (xy_strjoin (3, msg1, target_name, msg2)); + chsrc_error (xy_strcat (3, msg1, target_name, msg2)); exit (Exit_MaintainerCause); } @@ -520,7 +520,7 @@ query_mirror_exist (Source_t *sources, size_t size, char *target_name, char *inp : " 目前唯一可用镜像站,感谢他们的慷慨支持"; const char *name = ENGLISH ? sources[1].mirror->abbr : sources[1].mirror->name; - chsrc_succ (xy_strjoin (4, name, msg1, target_name, msg2)); + chsrc_succ (xy_strcat (4, name, msg1, target_name, msg2)); } if (xy_streql ("first", input)) @@ -549,11 +549,11 @@ query_mirror_exist (Source_t *sources, size_t size, char *target_name, char *inp { char *msg1 = ENGLISH ? "Mirror site " : "镜像站 "; char *msg2 = ENGLISH ? " doesn't exist" : " 不存在"; - chsrc_error (xy_strjoin (3, msg1, input, msg2)); + chsrc_error (xy_strcat (3, msg1, input, msg2)); } char *msg = ENGLISH ? "To see available sources, use chsrc list " : "查看可使用源,请使用 chsrc list "; - chsrc_error (xy_2strjoin (msg, target_name)); + chsrc_error (xy_2strcat (msg, target_name)); exit (Exit_UserCause); } return idx; @@ -626,12 +626,12 @@ measure_speed_for_url (void *url) /** * @note 我们用 —L,因为部分链接会跳转到其他地方,比如: RubyChina, npmmirror */ - char *curl_cmd = xy_strjoin (8, "curl -qsL ", ipv6, + char *curl_cmd = xy_strcat (8, "curl -qsL ", ipv6, " -o ", os_devnull, " -w \"%{http_code} %{speed_download}\" -m", time_sec, " -A chsrc/" Chsrc_Version " ", url); - // chsrc_info (xy_2strjoin ("测速命令 ", curl_cmd)); + // chsrc_info (xy_2strcat ("测速命令 ", curl_cmd)); char *curl_buf = xy_run (curl_cmd, 0); @@ -656,8 +656,8 @@ parse_and_say_curl_result (char *curl_buf) if (200!=http_code) { - char *http_code_str = yellow (xy_2strjoin ("HTTP码 ", curl_buf)); - say (xy_strjoin (3, speedstr, " | ", http_code_str)); + char *http_code_str = yellow (xy_2strcat ("HTTP码 ", curl_buf)); + say (xy_strcat (3, speedstr, " | ", http_code_str)); } else { @@ -728,7 +728,7 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor { char *msg1 = ENGLISH ? "Maintainers don't offer " : "维护者未提供 "; char *msg2 = ENGLISH ? " mirror site's speed measure link, so skip it" : " 镜像站测速链接,跳过该站点(需修复)"; - chsrc_warn (xy_strjoin (3, msg1, provider->code, msg2)); + chsrc_warn (xy_strcat (3, msg1, provider->code, msg2)); speed = 0; speed_records[i] = speed; @@ -740,7 +740,7 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor if (chef_is_url (provider_speed_url)) { url = xy_strdup (provider_speed_url); - chsrc_debug ("m", xy_2strjoin ("使用镜像站整体测速链接: ", url)); + chsrc_debug ("m", xy_2strcat ("使用镜像站整体测速链接: ", url)); } } else if (provider_skip) @@ -754,13 +754,13 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor { url = xy_strdup (dedicated_speed_url); has_dedicated_speed_url = true; - chsrc_debug ("m", xy_2strjoin ("使用专用测速链接: ", url)); + chsrc_debug ("m", xy_2strcat ("使用专用测速链接: ", url)); } else { /* 防止维护者没填,这里有一些脏数据,我们软处理:假装该链接URL不存在 */ has_dedicated_speed_url = false; - chsrc_debug ("m", xy_2strjoin ("专用测速链接为脏数据,请修复: ", provider->name)); + chsrc_debug ("m", xy_2strcat ("专用测速链接为脏数据,请修复: ", provider->name)); } } @@ -796,7 +796,7 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor { skip_reason = ENGLISH ? "SKIP for no reason" : "无理由跳过"; } - measure_msgs[i] = xy_strjoin (4, faint(" x "), msg, " ", yellow(faint(skip_reason))); + measure_msgs[i] = xy_strcat (4, faint(" x "), msg, " ", yellow(faint(skip_reason))); println (measure_msgs[i]); /* 下一位 */ @@ -823,11 +823,11 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor if (xy_streql ("upstream", provider->code)) { - measure_msgs[i] = xy_strjoin (7, faint(" ^ "), msg, " (", src.url, ") ", accurate_msg, faint(" ... ")); + measure_msgs[i] = xy_strcat (7, faint(" ^ "), msg, " (", src.url, ") ", accurate_msg, faint(" ... ")); } else { - measure_msgs[i] = xy_strjoin (5, faint(" - "), msg, " ", accurate_msg, faint(" ... ")); + measure_msgs[i] = xy_strcat (5, faint(" - "), msg, " ", accurate_msg, faint(" ... ")); } print (measure_msgs[i]); @@ -867,7 +867,7 @@ auto_select_mirror (Source_t *sources, size_t size, const char *target_name) { char *msg1 = ENGLISH ? "Currently " : "当前 "; char *msg2 = ENGLISH ? "No any source, please contact maintainers: chsrc issue" : " 无任何可用源,请联系维护者: chsrc issue"; - chsrc_error (xy_strjoin (3, msg1, target_name, msg2)); + chsrc_error (xy_strcat (3, msg1, target_name, msg2)); exit (Exit_MaintainerCause); } @@ -932,21 +932,21 @@ auto_select_mirror (Source_t *sources, size_t size, const char *target_name) : " 目前唯一可用镜像站,感谢他们的慷慨支持"; const char *name = ENGLISH ? sources[fast_idx].mirror->abbr : sources[fast_idx].mirror->name; - say (xy_strjoin (5, msg1, bdgreen(name), green(is), green(target_name), green(msg2))); + say (xy_strcat (5, msg1, bdgreen(name), green(is), green(target_name), green(msg2))); } else { char *msg = ENGLISH ? "FASTEST mirror site: " : "最快镜像站: "; const char *name = ENGLISH ? sources[fast_idx].mirror->abbr : sources[fast_idx].mirror->name; - say (xy_2strjoin (msg, green(name))); + say (xy_2strcat (msg, green(name))); } // https://github.com/RubyMetric/chsrc/pull/71 if (in_measure_mode()) { char *msg = ENGLISH ? "URL of above source: " : "镜像源地址: "; - say (xy_2strjoin (msg, green(sources[fast_idx].url))); + say (xy_2strcat (msg, green(sources[fast_idx].url))); } return fast_idx; @@ -1065,7 +1065,7 @@ chsrc_confirm_source (Source_t *source) else { char *msg = ENGLISH ? "SELECT mirror site: " : "选中镜像站: "; - say (xy_strjoin (5, msg, green (source->mirror->abbr), " (", green (source->mirror->code), ")")); + say (xy_strcat (5, msg, green (source->mirror->abbr), " (", green (source->mirror->code), ")")); } hr(); @@ -1110,7 +1110,7 @@ chsrc_determine_chgtype (ChgType_t type) #define MSG_EN_STILL "Still need to operate manually according to the above prompts. " #define MSG_CN_STILL "仍需按上述提示手工操作" -#define thank_mirror(msg) chsrc_log(xy_2strjoin(msg,purple(ENGLISH?source->mirror->abbr:source->mirror->name))) +#define thank_mirror(msg) chsrc_log(xy_2strcat(msg,purple(ENGLISH?source->mirror->abbr:source->mirror->name))) /** * @param source 可为NULL @@ -1345,10 +1345,10 @@ chsrc_make_tmpfile (char *filename, char *postfix, bool loud, char **tmpfilename * 然而 PowerShell 的执行,即使加了 -File 参数,也必须要求你拥有 .ps1 后缀 * 这使得我们在 Windows 上只能创建一个假的临时文件 */ - char *tmpfile = xy_strjoin (3, "chsrc_tmp_", filename, postfix); + char *tmpfile = xy_strcat (3, "chsrc_tmp_", filename, postfix); FILE *f = fopen (tmpfile, "w+"); #else - char *tmpfile = xy_strjoin (5, "/tmp/", "chsrc_tmp_", filename, "_XXXXXX", postfix); + char *tmpfile = xy_strcat (5, "/tmp/", "chsrc_tmp_", filename, "_XXXXXX", postfix); size_t postfix_len = strlen (postfix); /* 和 _mktemp_s() 参数不同,前者是整个缓存区大小,这里的长度是后缀长度 */ @@ -1359,14 +1359,14 @@ chsrc_make_tmpfile (char *filename, char *postfix, bool loud, char **tmpfilename if (!f) { char *msg = CHINESE ? "无法创建临时文件: " : "Unable to create temporary file: "; - msg = xy_2strjoin (msg, tmpfile); + msg = xy_2strcat (msg, tmpfile); chsrc_error2 (msg); exit (Exit_ExternalError); } else if (loud) { char *msg = CHINESE ? "已创建临时文件: " : "Temporary file created: "; - msg = xy_2strjoin (msg, tmpfile); + msg = xy_2strcat (msg, tmpfile); chsrc_succ2 (msg); } @@ -1404,7 +1404,7 @@ chsrc_run_as_bash_file (const char *script_content) char *msg = CHINESE ? "即将执行 Bash 脚本内容:" : "The Bash script content will be executed:"; chsrc_note2 (msg); println (faint(script_content)); - char *cmd = xy_2strjoin ("bash ", tmpfile); + char *cmd = xy_2strcat ("bash ", tmpfile); chsrc_run (cmd, RunOpt_Dont_Abort_On_Failure); remove (tmpfile); } @@ -1424,7 +1424,7 @@ chsrc_run_as_sh_file (const char *script_content) char *msg = CHINESE ? "即将执行 sh 脚本内容:" : "The sh script content will be executed:"; chsrc_note2 (msg); println (faint(script_content)); - char *cmd = xy_2strjoin ("sh ", tmpfile); + char *cmd = xy_2strcat ("sh ", tmpfile); chsrc_run (cmd, RunOpt_Dont_Abort_On_Failure); remove (tmpfile); } @@ -1443,7 +1443,7 @@ chsrc_run_as_pwsh_file (const char *script_content) char *msg = CHINESE ? "即将执行 PowerShell 脚本内容:" : "The PowerShell script content will be executed:"; chsrc_note2 (msg); println (faint(script_content)); - char *cmd = xy_2strjoin ("pwsh ", tmpfile); + char *cmd = xy_2strcat ("pwsh ", tmpfile); chsrc_run (cmd, RunOpt_Dont_Abort_On_Failure); remove (tmpfile); } @@ -1458,7 +1458,7 @@ XY_Deprecate_This("Don't use this function") void chsrc_run_in_inline_bash_shell (const char *cmdline) { - char *cmd = xy_strjoin (3, "bash -c '", cmdline, "'"); + char *cmd = xy_strcat (3, "bash -c '", cmdline, "'"); chsrc_run (cmd, RunOpt_Dont_Abort_On_Failure); } @@ -1472,7 +1472,7 @@ XY_Deprecate_This("Don't use this function") void chsrc_run_in_inline_pwsh_shell (const char *cmdline) { - char *cmd = xy_strjoin (3, "pwsh -Command '", cmdline, "'"); + char *cmd = xy_strcat (3, "pwsh -Command '", cmdline, "'"); chsrc_run (cmd, RunOpt_Dont_Abort_On_Failure); } @@ -1492,22 +1492,22 @@ chsrc_view_env (const char *var1, ...) #ifdef XY_On_Windows if (first) { - cmd = xy_strjoin (3, "set ", var, " "); + cmd = xy_strcat (3, "set ", var, " "); first = false; } else { - cmd = xy_strjoin (4, cmd, "& set ", var, " "); + cmd = xy_strcat (4, cmd, "& set ", var, " "); } #else if (first) { - cmd = xy_strjoin (5, "echo ", var, "=$", var, " "); + cmd = xy_strcat (5, "echo ", var, "=$", var, " "); first = false; } else { - cmd = xy_strjoin (6, cmd, "; echo ", var, "=$", var, " "); + cmd = xy_strcat (6, cmd, "; echo ", var, "=$", var, " "); } #endif var = va_arg (vars, const char *); @@ -1540,11 +1540,11 @@ chsrc_view_file (const char *path) path = xy_normalize_path (path); if (xy_on_windows) { - cmd = xy_2strjoin ("type ", path); + cmd = xy_2strcat ("type ", path); } else { - cmd = xy_2strjoin ("cat ", path); + cmd = xy_2strcat ("cat ", path); } chsrc_run_as_a_service (cmd); @@ -1570,13 +1570,13 @@ chsrc_ensure_dir (const char *dir) { mkdir_cmd = "mkdir -p "; } - char *cmd = xy_2strjoin (mkdir_cmd, dir); + char *cmd = xy_2strcat (mkdir_cmd, dir); cmd = xy_str_to_quietcmd (cmd); chsrc_run_as_a_service (cmd); char *msg = ENGLISH ? "Directory doesn't exist, created automatically " : "目录不存在,已自动创建 "; - chsrc_alert2 (xy_2strjoin (msg, dir)); + chsrc_alert2 (xy_2strcat (msg, dir)); } @@ -1595,8 +1595,8 @@ chsrc_append_to_file (const char *str, const char *filename) FILE *f = fopen (file, "a"); if (NULL==f) { - char *msg = ENGLISH ? xy_2strjoin ("Unable to open file to write: ", file) - : xy_2strjoin ("无法打开文件以写入: ", file); + char *msg = ENGLISH ? xy_2strcat ("Unable to open file to write: ", file) + : xy_2strcat ("无法打开文件以写入: ", file); chsrc_error2 (msg); exit (Exit_UserCause); } @@ -1606,8 +1606,8 @@ chsrc_append_to_file (const char *str, const char *filename) size_t ret = fwrite (str, len, 1, f); if (ret != 1) { - char *msg = ENGLISH ? xy_2strjoin ("Write failed to ", file) - : xy_2strjoin ("写入文件失败: ", file); + char *msg = ENGLISH ? xy_2strcat ("Write failed to ", file) + : xy_2strcat ("写入文件失败: ", file); chsrc_error2 (msg); exit (Exit_UserCause); } @@ -1622,11 +1622,11 @@ log_anyway: char *cmd = NULL; if (xy_on_windows) { - cmd = xy_strjoin (4, "echo ", str, " >> ", file); + cmd = xy_strcat (4, "echo ", str, " >> ", file); } else { - cmd = xy_strjoin (4, "echo '", str, "' >> ", file); + cmd = xy_strcat (4, "echo '", str, "' >> ", file); } chsrc_run_a_service (cmd); */ @@ -1651,7 +1651,7 @@ chsrc_prepend_to_file (const char *str, const char *filename) } else { - cmd = xy_strjoin (4, "sed -i '1i ", str, "' ", file); + cmd = xy_strcat (4, "sed -i '1i ", str, "' ", file); } chsrc_run_as_a_service (cmd); @@ -1675,11 +1675,11 @@ chsrc_overwrite_file (const char *str, const char *filename) char *cmd = NULL; if (xy_on_windows) { - cmd = xy_strjoin (4, "echo ", str, " > ", file); + cmd = xy_strcat (4, "echo ", str, " > ", file); } else { - cmd = xy_strjoin (4, "echo '", str, "' > ", file); + cmd = xy_strcat (4, "echo '", str, "' > ", file); } chsrc_run_as_a_service (cmd); @@ -1702,14 +1702,14 @@ chsrc_backup (const char *path) if (!exist) { char *msg = ENGLISH ? "File doesn't exist, skip backup: " : "文件不存在,跳过备份: "; - chsrc_alert2 (xy_2strjoin (msg, path)); + chsrc_alert2 (xy_2strcat (msg, path)); return; } if (xy_on_bsd || xy_on_macos) { /* BSD 和 macOS 的 cp 不支持 --backup 选项 */ - cmd = xy_strjoin (5, "cp -f ", path, " ", path, ".bak"); + cmd = xy_strcat (5, "cp -f ", path, " ", path, ".bak"); } else if (xy_on_windows) { @@ -1717,7 +1717,7 @@ chsrc_backup (const char *path) * @note /Y 表示覆盖 * @note 默认情况下会输出一个 "已复制 1个文件" */ - cmd = xy_strjoin (5, "copy /Y ", path, " ", path, ".bak 1>nul"); + cmd = xy_strcat (5, "copy /Y ", path, " ", path, ".bak 1>nul"); } else { @@ -1732,12 +1732,12 @@ chsrc_backup (const char *path) /* cp (GNU coreutils) 9.4 */ if (strstr (ver, "GNU coreutils")) { - cmd = xy_strjoin (5, "cp ", path, " ", path, ".bak --backup='t'"); + cmd = xy_strcat (5, "cp ", path, " ", path, ".bak --backup='t'"); } else { /* 非 GNU 的 cp 可能不支持 --backup ,如 busybox cp */ - cmd = xy_strjoin (5, "cp -f ", path, " ", path, ".bak"); + cmd = xy_strcat (5, "cp -f ", path, " ", path, ".bak"); } } diff --git a/src/recipe/lang/Dart/Flutter.c b/src/recipe/lang/Dart/Flutter.c index 0139575..cd9cafe 100644 --- a/src/recipe/lang/Dart/Flutter.c +++ b/src/recipe/lang/Dart/Flutter.c @@ -61,7 +61,7 @@ pl_dart_flutter_setsrc (char *option) char *cmd = NULL; if (xy_on_windows) { - cmd = xy_strjoin (3, "setx FLUTTER_STORAGE_BASE_URL \"", source.url, "\""); + cmd = xy_strcat (3, "setx FLUTTER_STORAGE_BASE_URL \"", source.url, "\""); chsrc_run (cmd, RunOpt_No_Last_New_Line); } else @@ -70,7 +70,7 @@ pl_dart_flutter_setsrc (char *option) char *bashrc = xy_bashrc; chsrc_backup (zshrc); - w = xy_strjoin (3, "export FLUTTER_STORAGE_BASE_URL=\"", source.url, "\"\n"); + w = xy_strcat (3, "export FLUTTER_STORAGE_BASE_URL=\"", source.url, "\"\n"); chsrc_append_to_file (w, zshrc); if (xy_file_exist (bashrc)) diff --git a/src/recipe/lang/Dart/Pub.c b/src/recipe/lang/Dart/Pub.c index e53eee2..d462325 100644 --- a/src/recipe/lang/Dart/Pub.c +++ b/src/recipe/lang/Dart/Pub.c @@ -57,7 +57,7 @@ pl_dart_setsrc (char *option) char *cmd = NULL; if (xy_on_windows) { - cmd = xy_strjoin (3, "setx PUB_HOSTED_URL \"", source.url, "\""); + cmd = xy_strcat (3, "setx PUB_HOSTED_URL \"", source.url, "\""); chsrc_run (cmd, RunOpt_No_Last_New_Line); } else @@ -66,7 +66,7 @@ pl_dart_setsrc (char *option) char *bashrc = xy_bashrc; chsrc_backup (zshrc); - w = xy_strjoin (3, "export PUB_HOSTED_URL=\"", source.url, "\"\n"); + w = xy_strcat (3, "export PUB_HOSTED_URL=\"", source.url, "\"\n"); chsrc_append_to_file (w, zshrc); diff --git a/src/recipe/lang/Go.c b/src/recipe/lang/Go.c index 7fb01e0..72f6cf3 100644 --- a/src/recipe/lang/Go.c +++ b/src/recipe/lang/Go.c @@ -89,7 +89,7 @@ pl_go_setsrc (char *option) char *cmd = "go env -w GO111MODULE=on"; chsrc_run (cmd, RunOpt_Default); - cmd = xy_strjoin (3, "go env -w GOPROXY=", source.url, ",direct"); + cmd = xy_strcat (3, "go env -w GOPROXY=", source.url, ",direct"); chsrc_run (cmd, RunOpt_Default); chsrc_conclude (&source); diff --git a/src/recipe/lang/Haskell.c b/src/recipe/lang/Haskell.c index 60d7983..ccd95cd 100644 --- a/src/recipe/lang/Haskell.c +++ b/src/recipe/lang/Haskell.c @@ -55,12 +55,12 @@ pl_haskell_setsrc (char *option) config = "~/.cabal/config"; } - chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:")); + chsrc_note2 (xy_strcat (3, "请向 ", config, " 中手动添加:")); println (content); config = xy_normalize_path ("~/.stack/config.yaml"); content = xy_str_gsub (RAWSTR_pl_haskell_stackage_yaml, "@url@", source.url); - chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:")); + chsrc_note2 (xy_strcat (3, "请向 ", config, " 中手动添加:")); println (content); chsrc_conclude (&source); diff --git a/src/recipe/lang/Java.c b/src/recipe/lang/Java.c index 4dd2d9c..c9b1161 100644 --- a/src/recipe/lang/Java.c +++ b/src/recipe/lang/Java.c @@ -56,7 +56,7 @@ pl_java_find_maven_config () char *maven_home = xy_str_delete_prefix (buf, "Maven home: "); maven_home = xy_str_strip (maven_home); - char *maven_config = xy_normalize_path (xy_2strjoin (maven_home, "/conf/settings.xml")); + char *maven_config = xy_normalize_path (xy_2strcat (maven_home, "/conf/settings.xml")); return maven_config; } @@ -67,7 +67,7 @@ pl_java_getsrc (char *option) bool maven_exist, gradle_exist; pl_java_check_cmd (&maven_exist, &gradle_exist); char *maven_config = pl_java_find_maven_config (); - chsrc_note2 (xy_2strjoin ("请查看 ", maven_config)); + chsrc_note2 (xy_2strcat ("请查看 ", maven_config)); } @@ -88,7 +88,7 @@ pl_java_setsrc (char *option) file = xy_str_gsub (file, "@name@", source.mirror->name); file = xy_str_gsub (file, "@url@", source.url); char *maven_config = pl_java_find_maven_config (); - chsrc_note2 (xy_strjoin (3, "请在 maven 配置文件 ", maven_config, " 中添加:")); + chsrc_note2 (xy_strcat (3, "请在 maven 配置文件 ", maven_config, " 中添加:")); println (file); } diff --git a/src/recipe/lang/JavaScript/Bun.c b/src/recipe/lang/JavaScript/Bun.c index 3f3780d..ae7108a 100644 --- a/src/recipe/lang/JavaScript/Bun.c +++ b/src/recipe/lang/JavaScript/Bun.c @@ -62,7 +62,7 @@ pl_js_bun_setsrc (char *option) } else { - chsrc_note2 (xy_strjoin (3, "请手动写入以下内容到 ", xy_normalize_path ("~/.bunfig.toml"), " 文件中")); + chsrc_note2 (xy_strcat (3, "请手动写入以下内容到 ", xy_normalize_path ("~/.bunfig.toml"), " 文件中")); } println (content); diff --git a/src/recipe/lang/JavaScript/Yarn.c b/src/recipe/lang/JavaScript/Yarn.c index d5662be..1d2ff97 100644 --- a/src/recipe/lang/JavaScript/Yarn.c +++ b/src/recipe/lang/JavaScript/Yarn.c @@ -68,9 +68,9 @@ pl_js_yarn_setsrc (char *option) if (pl_js_yarn_get_yarn_version () >= 2) { if (chsrc_in_local_mode()) // Yarn 默认情况下就是基于本项目换源 - cmd = xy_2strjoin ("yarn config set npmRegistryServer ", source.url); + cmd = xy_2strcat ("yarn config set npmRegistryServer ", source.url); else - cmd = xy_2strjoin ("yarn config set npmRegistryServer --home ", source.url); + cmd = xy_2strcat ("yarn config set npmRegistryServer --home ", source.url); chsrc_run (cmd, RunOpt_No_Last_New_Line); } @@ -84,7 +84,7 @@ pl_js_yarn_setsrc (char *option) return; } // 不再阻止换源命令输出到终端,即不再调用 xy_str_to_quietcmd() - cmd = xy_2strjoin ("yarn config set registry ", source.url); + cmd = xy_2strcat ("yarn config set registry ", source.url); chsrc_run (cmd, RunOpt_No_Last_New_Line); } diff --git a/src/recipe/lang/JavaScript/npm.c b/src/recipe/lang/JavaScript/npm.c index c723d6c..a4a4976 100644 --- a/src/recipe/lang/JavaScript/npm.c +++ b/src/recipe/lang/JavaScript/npm.c @@ -50,9 +50,9 @@ pl_js_npm_setsrc (char *option) char *cmd = NULL; if (chsrc_in_local_mode()) - cmd = xy_2strjoin ("npm config --location project set registry ", source.url); + cmd = xy_2strcat ("npm config --location project set registry ", source.url); else - cmd = xy_2strjoin ("npm config set registry ", source.url); + cmd = xy_2strcat ("npm config set registry ", source.url); chsrc_run (cmd, RunOpt_No_Last_New_Line); diff --git a/src/recipe/lang/JavaScript/nvm.c b/src/recipe/lang/JavaScript/nvm.c index 6a81141..02a0954 100644 --- a/src/recipe/lang/JavaScript/nvm.c +++ b/src/recipe/lang/JavaScript/nvm.c @@ -50,7 +50,7 @@ pl_js_nvm_setsrc (char *option) { Source_t source = chsrc_yield_source_and_confirm (&pl_js_nodejs_binary_target, option); - char *w = xy_strjoin (3, "export NVM_NODEJS_ORG_MIRROR=", source.url, "\n"); + char *w = xy_strcat (3, "export NVM_NODEJS_ORG_MIRROR=", source.url, "\n"); char *zshrc = xy_zshrc; char *bashrc = xy_bashrc; diff --git a/src/recipe/lang/JavaScript/pnpm.c b/src/recipe/lang/JavaScript/pnpm.c index 07e597c..895052e 100644 --- a/src/recipe/lang/JavaScript/pnpm.c +++ b/src/recipe/lang/JavaScript/pnpm.c @@ -50,9 +50,9 @@ pl_js_pnpm_setsrc (char *option) char *cmd = NULL; if (chsrc_in_local_mode()) - cmd = xy_2strjoin ("pnpm config --location project set registry ", source.url); + cmd = xy_2strcat ("pnpm config --location project set registry ", source.url); else - cmd = xy_2strjoin ("pnpm config -g set registry ", source.url); + cmd = xy_2strcat ("pnpm config -g set registry ", source.url); chsrc_run (cmd, RunOpt_No_Last_New_Line); diff --git a/src/recipe/lang/Julia.c b/src/recipe/lang/Julia.c index c4e191d..f709632 100644 --- a/src/recipe/lang/Julia.c +++ b/src/recipe/lang/Julia.c @@ -56,7 +56,7 @@ pl_julia_setsrc (char *option) { use_this_source(pl_julia); - char *w = xy_strjoin (3, "ENV[\"JULIA_PKG_SERVER\"] = \"", source.url, "\""); + char *w = xy_strcat (3, "ENV[\"JULIA_PKG_SERVER\"] = \"", source.url, "\""); chsrc_append_to_file (w, PL_Julia_Config); diff --git a/src/recipe/lang/Lua.c b/src/recipe/lang/Lua.c index fcdbd7b..ab18a33 100644 --- a/src/recipe/lang/Lua.c +++ b/src/recipe/lang/Lua.c @@ -53,14 +53,14 @@ pl_lua_setsrc (char *option) use_this(pl_lua); Source_t source = chsrc_yield_source_and_confirm (this, option); - char *config = xy_strjoin (3, "rocks_servers = {\n" + char *config = xy_strcat (3, "rocks_servers = {\n" " \"", source.url, "\"\n" "}"); chsrc_note2 ("请手动修改 ~/.luarocks/config.lua 文件 (用于下载):"); println (config); - char *upload_config = xy_strjoin (3, "key = \"\"\n" + char *upload_config = xy_strcat (3, "key = \"\"\n" "server = \"", source.url, "\""); chsrc_note2 ("请手动修改 ~/.luarocks/upload_config.lua 文件 (用于上传):"); diff --git a/src/recipe/lang/OCaml.c b/src/recipe/lang/OCaml.c index 0b419d7..b41edfa 100644 --- a/src/recipe/lang/OCaml.c +++ b/src/recipe/lang/OCaml.c @@ -55,14 +55,14 @@ pl_ocaml_setsrc (char *option) use_this_source(pl_ocaml); - char *cmd = xy_strjoin (3, "opam repo set-url default ", + char *cmd = xy_strcat (3, "opam repo set-url default ", source.url, " --all --set-default"); chsrc_run (cmd, RunOpt_Default); chsrc_alert2 ("如果是首次使用 opam ,请使用以下命令进行初始化"); - println (xy_2strjoin ("opam init default ", source.url)); + println (xy_2strcat ("opam init default ", source.url)); chsrc_conclude (&source); } diff --git a/src/recipe/lang/PHP.c b/src/recipe/lang/PHP.c index af33dd7..d69d05f 100644 --- a/src/recipe/lang/PHP.c +++ b/src/recipe/lang/PHP.c @@ -66,7 +66,7 @@ pl_php_setsrc (char *option) where = " "; } - char *cmd = xy_strjoin (4, "composer config", where, "repo.packagist composer ", source.url); + char *cmd = xy_strcat (4, "composer config", where, "repo.packagist composer ", source.url); chsrc_run (cmd, RunOpt_Default); chsrc_conclude (&source); diff --git a/src/recipe/lang/Perl.c b/src/recipe/lang/Perl.c index e0bc629..be2f19d 100644 --- a/src/recipe/lang/Perl.c +++ b/src/recipe/lang/Perl.c @@ -61,7 +61,7 @@ pl_perl_setsrc (char *option) { use_this_source(pl_perl); - char *cmd = xy_strjoin (3, + char *cmd = xy_strcat (3, "perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('urllist', 'unshift', '", source.url, "'); CPAN::HandleConfig->commit()\""); chsrc_run (cmd, RunOpt_Default); diff --git a/src/recipe/lang/Python/PDM.c b/src/recipe/lang/Python/PDM.c index ed5084c..fb3d196 100644 --- a/src/recipe/lang/Python/PDM.c +++ b/src/recipe/lang/Python/PDM.c @@ -52,9 +52,9 @@ pl_python_pdm_setsrc (char *option) char *cmd = NULL; if (chsrc_in_local_mode()) - cmd = xy_2strjoin ("pdm config --local pypi.url ", source.url); + cmd = xy_2strcat ("pdm config --local pypi.url ", source.url); else - cmd = xy_2strjoin ("pdm config --global pypi.url ", source.url); + cmd = xy_2strcat ("pdm config --global pypi.url ", source.url); chsrc_run (cmd, RunOpt_No_Last_New_Line); diff --git a/src/recipe/lang/Python/Poetry.c b/src/recipe/lang/Python/Poetry.c index 8392059..10065cc 100644 --- a/src/recipe/lang/Python/Poetry.c +++ b/src/recipe/lang/Python/Poetry.c @@ -50,7 +50,7 @@ pl_python_poetry_setsrc (char *option) if (!chsrc_in_local_mode()) chsrc_alert2 ("Poetry 仅支持项目级换源"); - cmd = xy_2strjoin ("poetry source add my_mirror ", source.url); + cmd = xy_2strcat ("poetry source add my_mirror ", source.url); chsrc_run (cmd, RunOpt_No_Last_New_Line); if (chsrc_in_standalone_mode()) diff --git a/src/recipe/lang/Python/Rye.c b/src/recipe/lang/Python/Rye.c index 26b5050..3623ac7 100644 --- a/src/recipe/lang/Python/Rye.c +++ b/src/recipe/lang/Python/Rye.c @@ -45,7 +45,7 @@ void pl_python_rye_getsrc (char *option) { char *rye_config = pl_python_find_rye_config (); - chsrc_note2 (xy_strjoin (3, "请查看 ", rye_config, " 配置文件中的 [[sources]] 节内容")); + chsrc_note2 (xy_strcat (3, "请查看 ", rye_config, " 配置文件中的 [[sources]] 节内容")); } @@ -64,7 +64,7 @@ pl_python_rye_setsrc (char *option) content = xy_str_gsub (content, "@2@", source.url); char *rye_config = pl_python_find_rye_config (); - chsrc_note2 (xy_strjoin (3, "请在配置文件 ", rye_config, " 中添加:")); + chsrc_note2 (xy_strcat (3, "请在配置文件 ", rye_config, " 中添加:")); println (content); chsrc_determine_chgtype (ChgType_Manual); diff --git a/src/recipe/lang/Python/common.h b/src/recipe/lang/Python/common.h index 9045dd5..cdd68d8 100644 --- a/src/recipe/lang/Python/common.h +++ b/src/recipe/lang/Python/common.h @@ -14,7 +14,7 @@ static char * pl_python_speed_url_constructor (const char *url, const char *user_data) { char *str = xy_str_delete_suffix (url, "/simple"); - str = xy_2strjoin (str, "/packages/56/e4/55aaac2b15af4dad079e5af329a79d961e5206589d0e02b1e8da221472ed/tensorflow-2.18.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl"); + str = xy_2strcat (str, "/packages/56/e4/55aaac2b15af4dad079e5af329a79d961e5206589d0e02b1e8da221472ed/tensorflow-2.18.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl"); return str; } diff --git a/src/recipe/lang/Python/pip.c b/src/recipe/lang/Python/pip.c index 1a2dc41..08f3ca0 100644 --- a/src/recipe/lang/Python/pip.c +++ b/src/recipe/lang/Python/pip.c @@ -35,7 +35,7 @@ pl_python_pip_getsrc (char *option) char *py_prog_name = NULL; pl_python_get_py_program_name (&py_prog_name); - char *cmd = xy_2strjoin (py_prog_name, " -m pip config get global.index-url"); + char *cmd = xy_2strcat (py_prog_name, " -m pip config get global.index-url"); chsrc_run (cmd, RunOpt_Default); } @@ -65,7 +65,7 @@ pl_python_pip_setsrc (char *option) // 这里用的是 config --user,会写入用户目录(而不是项目目录) // https://github.com/RubyMetric/chsrc/issues/39 // 经测试,Windows上调用换源命令,会写入 C:\Users\RubyMetric\AppData\Roaming\pip\pip.ini - char *cmd = xy_2strjoin (py_prog_name, xy_2strjoin (" -m pip config --user set global.index-url ", source.url)); + char *cmd = xy_2strcat (py_prog_name, xy_2strcat (" -m pip config --user set global.index-url ", source.url)); chsrc_run (cmd, RunOpt_No_Last_New_Line); if (chsrc_in_standalone_mode()) diff --git a/src/recipe/lang/Python/uv.c b/src/recipe/lang/Python/uv.c index 89314c1..a8dff93 100644 --- a/src/recipe/lang/Python/uv.c +++ b/src/recipe/lang/Python/uv.c @@ -51,7 +51,7 @@ pl_python_find_uv_config (bool mkdir) { if (chsrc_in_local_mode()) { - return xy_2strjoin (PL_Python_uv_Local_ConfigPath, PL_Python_uv_ConfigFile); + return xy_2strcat (PL_Python_uv_Local_ConfigPath, PL_Python_uv_ConfigFile); } else { @@ -66,12 +66,12 @@ pl_python_find_uv_config (bool mkdir) return NULL; } - char *config_dir = xy_2strjoin(appdata, "\\uv\\"); + char *config_dir = xy_2strcat(appdata, "\\uv\\"); if (mkdir) { chsrc_ensure_dir (config_dir); } - return xy_2strjoin (config_dir, PL_Python_uv_ConfigFile); + return xy_2strcat (config_dir, PL_Python_uv_ConfigFile); } else { @@ -80,7 +80,7 @@ pl_python_find_uv_config (bool mkdir) { chsrc_ensure_dir (PL_Python_uv_User_ConfigPath); } - return xy_2strjoin (PL_Python_uv_User_ConfigPath, PL_Python_uv_ConfigFile); + return xy_2strcat (PL_Python_uv_User_ConfigPath, PL_Python_uv_ConfigFile); } } } diff --git a/src/recipe/lang/R.c b/src/recipe/lang/R.c index 0be2c4a..40ca1fe 100644 --- a/src/recipe/lang/R.c +++ b/src/recipe/lang/R.c @@ -67,12 +67,12 @@ pl_r_setsrc (char *option) use_this_source(pl_r); char *bioconductor_url = xy_str_delete_suffix (xy_str_delete_suffix (source.url, "cran/"), "CRAN/"); - bioconductor_url = xy_2strjoin(bioconductor_url, "bioconductor"); + bioconductor_url = xy_2strcat(bioconductor_url, "bioconductor"); - const char *w1 = xy_strjoin (3, "options(\"repos\" = c(CRAN=\"", source.url, "\"))\n" ); - const char *w2 = xy_strjoin (3, "options(BioC_mirror=\"", bioconductor_url, "\")\n" ); + const char *w1 = xy_strcat (3, "options(\"repos\" = c(CRAN=\"", source.url, "\"))\n" ); + const char *w2 = xy_strcat (3, "options(BioC_mirror=\"", bioconductor_url, "\")\n" ); - char *w = xy_2strjoin (w1, w2); + char *w = xy_2strcat (w1, w2); // 或者我们调用 r.exe --slave -e 上面的内容 diff --git a/src/recipe/lang/Ruby/Ruby.c b/src/recipe/lang/Ruby/Ruby.c index b24cef5..bc7e7d4 100644 --- a/src/recipe/lang/Ruby/Ruby.c +++ b/src/recipe/lang/Ruby/Ruby.c @@ -58,7 +58,7 @@ pl_ruby_remove_gem_source (const char *source) char *cmd = NULL; if (chef_is_url (source)) { - cmd = xy_2strjoin ("gem sources -r ", source); + cmd = xy_2strcat ("gem sources -r ", source); chsrc_run (cmd, RunOpt_Default); } } @@ -78,7 +78,7 @@ pl_ruby_setsrc (char *option) // step1 xy_run_iter ("gem sources -l", 0, pl_ruby_remove_gem_source); - cmd = xy_2strjoin ("gem source -a ", source.url); + cmd = xy_2strcat ("gem source -a ", source.url); chsrc_run (cmd, RunOpt_Default); // 我们在 step1 中,把源全部清空了,但是现在 RubyGems 的行为是: 当清空会自动给你把默认源给加回来 @@ -94,7 +94,7 @@ pl_ruby_setsrc (char *option) where = " --local "; } - cmd = xy_strjoin (4, "bundle config", where, "'mirror.https://rubygems.org' ", source.url); + cmd = xy_strcat (4, "bundle config", where, "'mirror.https://rubygems.org' ", source.url); chsrc_run (cmd, RunOpt_No_Last_New_Line); chsrc_determine_chgtype (ChgType_Auto); diff --git a/src/recipe/lang/Rust/Cargo.c b/src/recipe/lang/Rust/Cargo.c index 43a89cc..eaf743e 100644 --- a/src/recipe/lang/Rust/Cargo.c +++ b/src/recipe/lang/Rust/Cargo.c @@ -72,7 +72,7 @@ pl_rust_cargo_setsrc (char *option) content = xy_str_gsub (content, "@url@", source.url); - chsrc_note2 (xy_strjoin (3, "请手动写入以下内容到 ", xy_normalize_path ("~/.cargo/config.toml"), " 文件中:")); + chsrc_note2 (xy_strcat (3, "请手动写入以下内容到 ", xy_normalize_path ("~/.cargo/config.toml"), " 文件中:")); println (content); chsrc_determine_chgtype (ChgType_Auto); diff --git a/src/recipe/lang/Rust/rustup.c b/src/recipe/lang/Rust/rustup.c index 637c236..7f9fbe2 100644 --- a/src/recipe/lang/Rust/rustup.c +++ b/src/recipe/lang/Rust/rustup.c @@ -64,18 +64,18 @@ pl_rust_rustup_setsrc (char *option) #ifdef XY_On_Windows - char *cmd1 = xy_strjoin (3, "setx RUSTUP_DIST_SERVER \"", source.url, "\""); - char *cmd2 = xy_strjoin (3, "setx RUSTUP_UPDATE_ROOT \"", source.url, "/rustup\""); + char *cmd1 = xy_strcat (3, "setx RUSTUP_DIST_SERVER \"", source.url, "\""); + char *cmd2 = xy_strcat (3, "setx RUSTUP_UPDATE_ROOT \"", source.url, "/rustup\""); - char *cmd = xy_strjoin (3, cmd1, " & ", cmd2); + char *cmd = xy_strcat (3, cmd1, " & ", cmd2); chsrc_run (cmd, RunOpt_Dont_Notify_On_Success|RunOpt_No_Last_New_Line); #else - char *w1 = xy_strjoin (3, "export RUSTUP_DIST_SERVER=\"", source.url, "\"\n"); - char *w2 = xy_strjoin (3, "export RUSTUP_UPDATE_ROOT=\"", source.url, "/rustup\"\n"); + char *w1 = xy_strcat (3, "export RUSTUP_DIST_SERVER=\"", source.url, "\"\n"); + char *w2 = xy_strcat (3, "export RUSTUP_UPDATE_ROOT=\"", source.url, "/rustup\"\n"); - char *w = xy_2strjoin (w1, w2); + char *w = xy_2strcat (w1, w2); char *bashrc = xy_bashrc; if (xy_file_exist (bashrc)) @@ -94,10 +94,10 @@ pl_rust_rustup_setsrc (char *option) char *fishrc = xy_fishrc; if (xy_file_exist (fishrc)) { - char *w1 = xy_strjoin (3, "set -x RUSTUP_DIST_SERVER ", source.url, "\n"); - char *w2 = xy_strjoin (3, "set -x RUSTUP_UPDATE_ROOT ", source.url, "/rustup\n"); + char *w1 = xy_strcat (3, "set -x RUSTUP_DIST_SERVER ", source.url, "\n"); + char *w2 = xy_strcat (3, "set -x RUSTUP_UPDATE_ROOT ", source.url, "/rustup\n"); - char *w = xy_2strjoin (w1, w2); + char *w = xy_2strcat (w1, w2); chsrc_backup (fishrc); chsrc_append_to_file (w, fishrc); diff --git a/src/recipe/os/APT/Armbian.c b/src/recipe/os/APT/Armbian.c index 84220d1..b87595f 100644 --- a/src/recipe/os/APT/Armbian.c +++ b/src/recipe/os/APT/Armbian.c @@ -68,7 +68,7 @@ os_armbian_setsrc (char *option) chsrc_backup (OS_Armbian_SourceList); - char *cmd = xy_strjoin (3, "sed -E -i 's@https?[^ ]*armbian/?[^ ]*@", source.url, + char *cmd = xy_strcat (3, "sed -E -i 's@https?[^ ]*armbian/?[^ ]*@", source.url, "@g' " OS_Armbian_SourceList); chsrc_run (cmd, RunOpt_Default); diff --git a/src/recipe/os/APT/Debian.c b/src/recipe/os/APT/Debian.c index ecb935a..af0d76f 100644 --- a/src/recipe/os/APT/Debian.c +++ b/src/recipe/os/APT/Debian.c @@ -77,7 +77,7 @@ static bool os_debian_does_old_sourcelist_use_cdrom (void) { /* 我们只检查旧版sourcelist,因为 common.h 中的填充只支持旧版 */ - char *cmd = xy_2strjoin ("grep -q '^deb cdrom:' ", OS_Debian_old_SourceList); + char *cmd = xy_2strcat ("grep -q '^deb cdrom:' ", OS_Debian_old_SourceList); int ret = system (cmd); bool use_cdrom = ret == 0; @@ -92,11 +92,11 @@ os_debian_setsrc_for_deb822 (char *option) chsrc_backup (OS_Debian_SourceList_DEB822); - char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/debian/?@", source.url, "@g' " OS_Debian_SourceList_DEB822); + char *cmd = xy_strcat (3, "sed -E -i 's@https?://.*/debian/?@", source.url, "@g' " OS_Debian_SourceList_DEB822); chsrc_run (cmd, RunOpt_Default); /* debian-security 源和其他源不一样 */ - cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/debian-security/?@", source.url, "-security@g' " OS_Debian_SourceList_DEB822); + cmd = xy_strcat (3, "sed -E -i 's@https?://.*/debian-security/?@", source.url, "-security@g' " OS_Debian_SourceList_DEB822); chsrc_run (cmd, RunOpt_Default); chsrc_run ("apt update", RunOpt_No_Last_New_Line); @@ -160,7 +160,7 @@ os_debian_setsrc (char *option) chsrc_backup (OS_Debian_old_SourceList); } - char *cmd = xy_strjoin (3, "sed -E -i \'s@https?://.*/debian/?@", source.url, "@g\' " OS_Debian_old_SourceList); + char *cmd = xy_strcat (3, "sed -E -i \'s@https?://.*/debian/?@", source.url, "@g\' " OS_Debian_old_SourceList); chsrc_run (cmd, RunOpt_Default); chsrc_run ("apt update", RunOpt_No_Last_New_Line); diff --git a/src/recipe/os/APT/Kali-Linux.c b/src/recipe/os/APT/Kali-Linux.c index 2f2b6c0..341a7ba 100644 --- a/src/recipe/os/APT/Kali-Linux.c +++ b/src/recipe/os/APT/Kali-Linux.c @@ -55,7 +55,7 @@ os_kali_setsrc (char *option) chsrc_backup (OS_Apt_SourceList); - char *cmd = xy_strjoin (3, "sed -E -i \'s@https?://.*/kali/?@", + char *cmd = xy_strcat (3, "sed -E -i \'s@https?://.*/kali/?@", source.url, "@g\' " OS_Apt_SourceList); diff --git a/src/recipe/os/APT/Linux-Lite.c b/src/recipe/os/APT/Linux-Lite.c index b3c7578..4814c12 100644 --- a/src/recipe/os/APT/Linux-Lite.c +++ b/src/recipe/os/APT/Linux-Lite.c @@ -53,7 +53,7 @@ os_linuxlite_setsrc (char *option) chsrc_backup (OS_Apt_SourceList); - char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/.*/?@", source.url, "@g' " OS_Apt_SourceList); + char *cmd = xy_strcat (3, "sed -E -i 's@https?://.*/.*/?@", source.url, "@g' " OS_Apt_SourceList); chsrc_run ("apt update", RunOpt_No_Last_New_Line); diff --git a/src/recipe/os/APT/Linux-Mint.c b/src/recipe/os/APT/Linux-Mint.c index 02dba06..d792935 100644 --- a/src/recipe/os/APT/Linux-Mint.c +++ b/src/recipe/os/APT/Linux-Mint.c @@ -69,7 +69,7 @@ os_linuxmint_setsrc (char *option) // 暂不实现自动替换基于debian或ubuntu的基础源 char *version_codename = xy_run ("sed -nr 's/^VERSION_CODENAME=([^\"]+)/\1/p' " ETC_OS_RELEASE, 0); // sed -i '// s|http[^ ]*||g' OS_LinuxMint_SourceList - char* cmd = xy_strjoin (5, "sed -i '/", + char* cmd = xy_strcat (5, "sed -i '/", version_codename, "/ s|http[^ ]*|", source.url, "|g' " OS_LinuxMint_SourceList); diff --git a/src/recipe/os/APT/ROS.c b/src/recipe/os/APT/ROS.c index 62302a5..3745ba6 100644 --- a/src/recipe/os/APT/ROS.c +++ b/src/recipe/os/APT/ROS.c @@ -64,7 +64,7 @@ os_ros_setsrc (char *option) chsrc_backup (OS_ROS_SourceList); char *cmd = NULL; - cmd = xy_strjoin(3, "sed -E -i \'s@https?://.*/ros/ubuntu/?@", source.url, "/ros/ubuntu@g\' " OS_ROS_SourceList); + cmd = xy_strcat(3, "sed -E -i \'s@https?://.*/ros/ubuntu/?@", source.url, "/ros/ubuntu@g\' " OS_ROS_SourceList); chsrc_run(cmd, RunOpt_Default); cmd = "apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654"; diff --git a/src/recipe/os/APT/Raspberry-Pi-OS.c b/src/recipe/os/APT/Raspberry-Pi-OS.c index 6406925..e7b111c 100644 --- a/src/recipe/os/APT/Raspberry-Pi-OS.c +++ b/src/recipe/os/APT/Raspberry-Pi-OS.c @@ -57,7 +57,7 @@ os_raspberrypi_setsrc (char *option) chsrc_backup (OS_RaspberryPi_SourceList); - char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/.*/?@", source.url, + char *cmd = xy_strcat (3, "sed -E -i 's@https?://.*/.*/?@", source.url, "@g' " OS_RaspberryPi_SourceList); chsrc_run (cmd, RunOpt_Default); diff --git a/src/recipe/os/APT/Termux.c b/src/recipe/os/APT/Termux.c index 1ff60c5..0c46a6b 100644 --- a/src/recipe/os/APT/Termux.c +++ b/src/recipe/os/APT/Termux.c @@ -63,7 +63,7 @@ os_termux_setsrc (char *option) use_this_source(os_termux); - char *cmd = xy_strjoin (3, "sed -i 's@^\\(deb.*stable main\\)$@#\\1\\ndeb ", + char *cmd = xy_strcat (3, "sed -i 's@^\\(deb.*stable main\\)$@#\\1\\ndeb ", source.url, "apt/termux-main stable main@' " OS_Termux_SourceList); chsrc_run (cmd, RunOpt_Default); diff --git a/src/recipe/os/APT/Trisquel.c b/src/recipe/os/APT/Trisquel.c index 2b44952..9244764 100644 --- a/src/recipe/os/APT/Trisquel.c +++ b/src/recipe/os/APT/Trisquel.c @@ -57,7 +57,7 @@ os_trisquel_setsrc (char *option) chsrc_backup (OS_Apt_SourceList); - char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/trisquel/?@", source.url, "@g' /etc/apt/sources.list"); + char *cmd = xy_strcat (3, "sed -E -i 's@https?://.*/trisquel/?@", source.url, "@g' /etc/apt/sources.list"); chsrc_run (cmd, RunOpt_Default); chsrc_run ("apt update", RunOpt_No_Last_New_Line); diff --git a/src/recipe/os/APT/Ubuntu.c b/src/recipe/os/APT/Ubuntu.c index 2d16f2b..fd748d3 100644 --- a/src/recipe/os/APT/Ubuntu.c +++ b/src/recipe/os/APT/Ubuntu.c @@ -88,11 +88,11 @@ os_ubuntu_setsrc_for_deb822 (char *option) char *cmd = NULL; if (strncmp (arch, "x86_64", 6)==0) { - cmd = xy_strjoin (3, "sed -E -i \'s@https?://.*/ubuntu/?@", source.url, "@g\' " OS_Ubuntu_SourceList_DEB822); + cmd = xy_strcat (3, "sed -E -i \'s@https?://.*/ubuntu/?@", source.url, "@g\' " OS_Ubuntu_SourceList_DEB822); } else { - cmd = xy_strjoin (3, "sed -E -i \'s@https?://.*/ubuntu-ports/?@", source.url, "-ports@g\' " OS_Ubuntu_SourceList_DEB822); + cmd = xy_strcat (3, "sed -E -i \'s@https?://.*/ubuntu-ports/?@", source.url, "-ports@g\' " OS_Ubuntu_SourceList_DEB822); } chsrc_run (cmd, RunOpt_Default); @@ -135,11 +135,11 @@ os_ubuntu_setsrc (char *option) char *cmd = NULL; if (0==strncmp (arch, "x86_64", 6)) { - cmd = xy_strjoin (3, "sed -E -i \'s@https?://.*/ubuntu/?@", source.url, "@g\' " OS_Ubuntu_old_SourceList); + cmd = xy_strcat (3, "sed -E -i \'s@https?://.*/ubuntu/?@", source.url, "@g\' " OS_Ubuntu_old_SourceList); } else { - cmd = xy_strjoin (3, "sed -E -i \'s@https?://.*/ubuntu-ports/?@", source.url, "-ports@g\' " OS_Ubuntu_old_SourceList); + cmd = xy_strcat (3, "sed -E -i \'s@https?://.*/ubuntu-ports/?@", source.url, "-ports@g\' " OS_Ubuntu_old_SourceList); } chsrc_run (cmd, RunOpt_Default); diff --git a/src/recipe/os/APT/deepin.c b/src/recipe/os/APT/deepin.c index 094c76a..0caba9f 100644 --- a/src/recipe/os/APT/deepin.c +++ b/src/recipe/os/APT/deepin.c @@ -60,7 +60,7 @@ os_deepin_setsrc (char *option) chsrc_backup (OS_Apt_SourceList); - char *cmd = xy_strjoin (3, "sed -E -i \'s@https?://.*/deepin/?@", + char *cmd = xy_strcat (3, "sed -E -i \'s@https?://.*/deepin/?@", source.url, "@g\' " OS_Apt_SourceList); diff --git a/src/recipe/os/APT/openKylin.c b/src/recipe/os/APT/openKylin.c index a6aaa50..462fecf 100644 --- a/src/recipe/os/APT/openKylin.c +++ b/src/recipe/os/APT/openKylin.c @@ -51,7 +51,7 @@ os_openkylin_setsrc (char *option) chsrc_backup (OS_Apt_SourceList); - char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/openkylin/?@", source.url, "@g'" OS_Apt_SourceList); + char *cmd = xy_strcat (3, "sed -E -i 's@https?://.*/openkylin/?@", source.url, "@g'" OS_Apt_SourceList); chsrc_run (cmd, RunOpt_Default); chsrc_run ("apt update", RunOpt_No_Last_New_Line); diff --git a/src/recipe/os/Alpine-Linux.c b/src/recipe/os/Alpine-Linux.c index f9f7a29..faeb8a9 100644 --- a/src/recipe/os/Alpine-Linux.c +++ b/src/recipe/os/Alpine-Linux.c @@ -59,7 +59,7 @@ os_alpine_setsrc (char *option) use_this_source(os_alpine); - char* cmd = xy_strjoin (3, + char* cmd = xy_strcat (3, "sed -i 's#https\\?://dl-cdn.alpinelinux.org/alpine#", source.url, "#g' /etc/apk/repositories" ); chsrc_run (cmd, RunOpt_Default); diff --git a/src/recipe/os/BSD/FreeBSD.c b/src/recipe/os/BSD/FreeBSD.c index 669a77c..b4abd58 100644 --- a/src/recipe/os/BSD/FreeBSD.c +++ b/src/recipe/os/BSD/FreeBSD.c @@ -57,9 +57,9 @@ os_freebsd_setsrc (char *option) chsrc_log2 ("1. 添加 freebsd-pkg 源 (二进制安装包)"); chsrc_ensure_dir ("/usr/local/etc/pkg/repos"); - char *conf = xy_strjoin (3, "/usr/local/etc/pkg/repos/", source.mirror->code, ".conf"); + char *conf = xy_strcat (3, "/usr/local/etc/pkg/repos/", source.mirror->code, ".conf"); - char *pkg_content = xy_strjoin (4, + char *pkg_content = xy_strcat (4, source.mirror->code, ": { \n" " url: \"http://", source.url, "/freebsd-pkg/${ABI}/latest\",\n" "}\n" @@ -68,7 +68,7 @@ os_freebsd_setsrc (char *option) chsrc_overwrite_file (pkg_content, conf); chsrc_note2 ( - xy_strjoin (3, "若要使用季度分支,请在", conf ,"中将latest改为quarterly")); + xy_strcat (3, "若要使用季度分支,请在", conf ,"中将latest改为quarterly")); chsrc_alert2 ("若要使用HTTPS源,请先安装securtiy/ca_root_ns,并将'http'改成'https',最后使用'pkg update -f'刷新缓存即可\n"); br(); @@ -84,14 +84,14 @@ os_freebsd_setsrc (char *option) { source = this->sources[index-1]; // 使用NJU的前一个源,即USTC源 } - char *git_cmd = xy_strjoin (3, "git clone --depth 1 https://", source.url, "/freebsd-ports/ports.git /usr/ports"); + char *git_cmd = xy_strcat (3, "git clone --depth 1 https://", source.url, "/freebsd-ports/ports.git /usr/ports"); chsrc_run (git_cmd, RunOpt_Default); source = this->sources[index]; // 恢复至选中的源 chsrc_alert2 ("下次更新请使用 git -C /usr/ports pull 而非使用 gitup"); } else { - char *fetch = xy_strjoin (3, "fetch https://", source.url, "/freebsd-ports/ports.tar.gz"); // 70多MB + char *fetch = xy_strcat (3, "fetch https://", source.url, "/freebsd-ports/ports.tar.gz"); // 70多MB char *unzip = "tar -zxvf ports.tar.gz -C /usr/ports"; char *delete = "rm ports.tar.gz"; chsrc_run (fetch, RunOpt_Default); @@ -105,7 +105,7 @@ os_freebsd_setsrc (char *option) // https://help.mirrors.cernet.edu.cn/FreeBSD-ports/ chsrc_backup ("/etc/make.conf"); - char *ports = xy_strjoin (3, "MASTER_SITE_OVERRIDE?=http://", source.url, "/freebsd-ports/distfiles/${DIST_SUBDIR}/\n"); + char *ports = xy_strcat (3, "MASTER_SITE_OVERRIDE?=http://", source.url, "/freebsd-ports/distfiles/${DIST_SUBDIR}/\n"); chsrc_append_to_file (ports, "/etc/make.conf"); @@ -113,7 +113,7 @@ os_freebsd_setsrc (char *option) /* chsrc_backup ("/etc/portsnap.conf"); - char *portsnap =xy_strjoin(3,"s@(.*)SERVERNAME=[\\.|a-z|A-Z]*@\\1SERVERNAME=", source.url, + char *portsnap =xy_strcat(3,"s@(.*)SERVERNAME=[\\.|a-z|A-Z]*@\\1SERVERNAME=", source.url, "@g < /etc/portsnap.conf.bak"); chsrc_overwrite_file (portsnap, "/etc/portsnap.conf"); @@ -131,7 +131,7 @@ os_freebsd_setsrc (char *option) char *update_cp = "cp /etc/freebsd-update.conf /etc/freebsd-update.conf.bak"; chsrc_run (update_cp, RunOpt_Default); - char *update =xy_strjoin (3,"s@(.*)SERVERNAME [\\.|a-z|A-Z]*@\\1SERVERNAME ", + char *update =xy_strcat (3,"s@(.*)SERVERNAME [\\.|a-z|A-Z]*@\\1SERVERNAME ", source.url, "@g < /etc/freebsd-update.conf.bak"); diff --git a/src/recipe/os/BSD/NetBSD.c b/src/recipe/os/BSD/NetBSD.c index c318f2b..1660fae 100644 --- a/src/recipe/os/BSD/NetBSD.c +++ b/src/recipe/os/BSD/NetBSD.c @@ -68,7 +68,7 @@ os_netbsd_setsrc (char *option) char *vercmd = "cat /etc/os-release | grep \"VERSION=\" | grep -Po \"[8-9].[0-9]+\""; char *version = xy_run (vercmd, 0); - char *url = xy_strjoin (5, chef_ensure_trailing_slash (source.url), arch, "/", version, "/All"); + char *url = xy_strcat (5, chef_ensure_trailing_slash (source.url), arch, "/", version, "/All"); chsrc_overwrite_file (url, "/usr/pkg/etc/pkgin/repositories.conf"); chsrc_conclude (&source); diff --git a/src/recipe/os/Gentoo-Linux.c b/src/recipe/os/Gentoo-Linux.c index 7878c01..44685c9 100644 --- a/src/recipe/os/Gentoo-Linux.c +++ b/src/recipe/os/Gentoo-Linux.c @@ -49,12 +49,12 @@ os_gentoo_setsrc (char *option) chsrc_backup ("/etc/portage/repos.conf/gentoo.conf"); - char *cmd = xy_strjoin (3, "sed -i \"s#rsync://.*/gentoo-portage#rsync://", + char *cmd = xy_strcat (3, "sed -i \"s#rsync://.*/gentoo-portage#rsync://", source.url, "gentoo-portage#g"); chsrc_run (cmd, RunOpt_Default); - char *w = xy_strjoin (3, "GENTOO_MIRRORS=\"https://", source.url, "gentoo\"\n"); + char *w = xy_strcat (3, "GENTOO_MIRRORS=\"https://", source.url, "gentoo\"\n"); chsrc_append_to_file (w, "/etc/portage/make.conf"); diff --git a/src/recipe/os/OpenWrt.c b/src/recipe/os/OpenWrt.c index 6f02ba6..2f05ddc 100644 --- a/src/recipe/os/OpenWrt.c +++ b/src/recipe/os/OpenWrt.c @@ -65,7 +65,7 @@ os_openwrt_setsrc (char *option) chsrc_backup (OS_OpenWRT_SourceConfig); - char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/releases@", source.url, "/releases@g' " OS_OpenWRT_SourceConfig); + char *cmd = xy_strcat (3, "sed -E -i 's@https?://.*/releases@", source.url, "/releases@g' " OS_OpenWRT_SourceConfig); chsrc_run (cmd, RunOpt_No_Last_New_Line); chsrc_run ("opkg update", RunOpt_No_Last_New_Line); diff --git a/src/recipe/os/Solus.c b/src/recipe/os/Solus.c index 55a3e86..482ddfb 100644 --- a/src/recipe/os/Solus.c +++ b/src/recipe/os/Solus.c @@ -45,7 +45,7 @@ os_solus_setsrc (char *option) use_this_source(os_solus); - char *cmd = xy_2strjoin ("eopkg add-repo Solus ", source.url); + char *cmd = xy_2strcat ("eopkg add-repo Solus ", source.url); chsrc_run (cmd, RunOpt_Default); chsrc_determine_chgtype (ChgType_Auto); diff --git a/src/recipe/os/Void-Linux.c b/src/recipe/os/Void-Linux.c index c984e46..efd8ca9 100644 --- a/src/recipe/os/Void-Linux.c +++ b/src/recipe/os/Void-Linux.c @@ -58,12 +58,12 @@ os_voidlinux_setsrc (char *option) char *cmd = "cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/"; chsrc_run (cmd, RunOpt_Default); - cmd = xy_strjoin (3, + cmd = xy_strcat (3, "sed -i 's|https://repo-default.voidlinux.org|", source.url, "|g' /etc/xbps.d/*-repository-*.conf" ); chsrc_run (cmd, RunOpt_Default); - cmd = xy_strjoin (3, + cmd = xy_strcat (3, "sed -i 's|https://alpha.de.repo.voidlinux.org|", source.url, "|g' /etc/xbps.d/*-repository-*.conf" ); diff --git a/src/recipe/os/YUM/AlmaLinux.c b/src/recipe/os/YUM/AlmaLinux.c index ecfb04c..c36a2a5 100644 --- a/src/recipe/os/YUM/AlmaLinux.c +++ b/src/recipe/os/YUM/AlmaLinux.c @@ -48,7 +48,7 @@ os_almalinux_setsrc (char *option) use_this_source(os_almalinux); - char *cmd = xy_strjoin (3, + char *cmd = xy_strcat (3, "sed -e 's|^mirrorlist=|#mirrorlist=|g' -e 's|^#\\s*baseurl=https://repo.almalinux.org/almalinux|baseurl=", source.url, "|g' -i.bak /etc/yum.repos.d/almalinux*.repo"); chsrc_run (cmd, RunOpt_Default); diff --git a/src/recipe/os/YUM/Anolis-OS.c b/src/recipe/os/YUM/Anolis-OS.c index 706a7af..8624ab1 100644 --- a/src/recipe/os/YUM/Anolis-OS.c +++ b/src/recipe/os/YUM/Anolis-OS.c @@ -43,7 +43,7 @@ os_anolis_setsrc (char *option) use_this_source(os_anolis); - char *cmd = xy_strjoin (3, "sed -i.bak -E 's|https?://(mirrors\\.openanolis\\.cn/anolis)|", source.url, "|g' /etc/yum.repos.d/*.repo"); + char *cmd = xy_strcat (3, "sed -i.bak -E 's|https?://(mirrors\\.openanolis\\.cn/anolis)|", source.url, "|g' /etc/yum.repos.d/*.repo"); chsrc_run (cmd, RunOpt_Default); chsrc_run ("dnf makecache", RunOpt_Default); diff --git a/src/recipe/os/YUM/Fedora-Linux.c b/src/recipe/os/YUM/Fedora-Linux.c index 66c12e5..ec3dc60 100644 --- a/src/recipe/os/YUM/Fedora-Linux.c +++ b/src/recipe/os/YUM/Fedora-Linux.c @@ -63,7 +63,7 @@ os_fedora_setsrc (char *option) chsrc_backup ("/etc/yum.repos.d/fedora-updates.repo"); // 取消对 baseurl 的注释 - char* cmd = xy_strjoin (5, "sed ", + char* cmd = xy_strcat (5, "sed ", "-i 's|^#baseurl=|baseurl=", "|g' ", "/etc/yum.repos.d/fedora.repo ", @@ -73,7 +73,7 @@ os_fedora_setsrc (char *option) // 替换 // (1) baseurl=<>/releases/... // (2) baseurl=<>/updates/... - cmd = xy_strjoin (7, "sed ", + cmd = xy_strcat (7, "sed ", "-i -E 's!^baseurl=.*?/(releases|updates)/!baseurl=", source.url, "/\\1/", diff --git a/src/recipe/os/YUM/Rocky-Linux.c b/src/recipe/os/YUM/Rocky-Linux.c index 146c449..50b3cda 100644 --- a/src/recipe/os/YUM/Rocky-Linux.c +++ b/src/recipe/os/YUM/Rocky-Linux.c @@ -58,7 +58,7 @@ os_rockylinux_setsrc (char *option) if (version < 9) { - cmd = xy_strjoin (3, + cmd = xy_strcat (3, "sed -e 's|^mirrorlist=|#mirrorlist=|g' " "-e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=", source.url, "|g' " "-i.bak /etc/yum.repos.d/Rocky-*.repo" @@ -70,7 +70,7 @@ os_rockylinux_setsrc (char *option) } else { - cmd = xy_strjoin (3, + cmd = xy_strcat (3, "sed -e 's|^mirrorlist=|#mirrorlist=|g' " "-e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=", source.url, "|g' " "-i.bak /etc/yum.repos.d/rocky-extras.repo /etc/yum.repos.d/rocky.repo" diff --git a/src/recipe/os/YUM/openEuler.c b/src/recipe/os/YUM/openEuler.c index 98ddc6e..b53ba11 100644 --- a/src/recipe/os/YUM/openEuler.c +++ b/src/recipe/os/YUM/openEuler.c @@ -73,7 +73,7 @@ os_openeuler_setsrc (char *option) // 替换 baseurl=<>/openEuler-xx.xx/... // openEuler-xx.xx 为 openEuler 版本号 // sed -E 's!^baseurl=.*?/openEuler-([^/]+)!baseurl=$(source.url)/openEuler-\1/!g' OS_openEuler_SourceList - char* cmd = xy_strjoin (6, "sed ", + char* cmd = xy_strcat (6, "sed ", "-i -E 's!^baseurl=.*?/openEuler-([^/]+)!baseurl=", source.url, "openEuler-\\1", diff --git a/src/recipe/os/pacman/Arch-Linux.c b/src/recipe/os/pacman/Arch-Linux.c index a200b26..59d4838 100644 --- a/src/recipe/os/pacman/Arch-Linux.c +++ b/src/recipe/os/pacman/Arch-Linux.c @@ -81,12 +81,12 @@ os_arch_setsrc (char *option) if (strncmp(arch, "x86_64", 6)==0) { is_x86 = true; - to_write = xy_strjoin (3, "Server = ", source.url, "/$repo/os/$arch"); + to_write = xy_strcat (3, "Server = ", source.url, "/$repo/os/$arch"); } else { is_x86 = false; - to_write = xy_strjoin (3, "Server = ", source.url, "arm/$arch/$repo"); + to_write = xy_strcat (3, "Server = ", source.url, "arm/$arch/$repo"); } /* 配置文件中,越前面的优先级越高 */ @@ -181,13 +181,13 @@ os_archlinuxcn_setsrc (char *option) if (ret == 0) { - char *sed_cmd = xy_strjoin (4, "sed -i '/\\[archlinuxcn\\]/{n;s|^Server = .*|Server = ", + char *sed_cmd = xy_strcat (4, "sed -i '/\\[archlinuxcn\\]/{n;s|^Server = .*|Server = ", source.url, "$arch|;}' ", OS_Pacman_ArchLinuxCN_MirrorList); chsrc_run (sed_cmd, RunOpt_Default); } else { - char *archlinuxcn_config = xy_strjoin (3, "\n[archlinuxcn]\nServer = ", source.url, "$arch\n"); + char *archlinuxcn_config = xy_strcat (3, "\n[archlinuxcn]\nServer = ", source.url, "$arch\n"); chsrc_append_to_file (archlinuxcn_config, OS_Pacman_ArchLinuxCN_MirrorList); } diff --git a/src/recipe/os/pacman/MSYS2.c b/src/recipe/os/pacman/MSYS2.c index b5b3406..49456f2 100644 --- a/src/recipe/os/pacman/MSYS2.c +++ b/src/recipe/os/pacman/MSYS2.c @@ -52,12 +52,12 @@ os_msys2_setsrc (char *option) chsrc_backup ("/etc/pacman.d/mirrorlist.mingw64"); chsrc_backup ("/etc/pacman.d/mirrorlist.msys"); - char *prev = xy_strjoin (3, "请针对你的架构下载安装此目录下的文件:", + char *prev = xy_strcat (3, "请针对你的架构下载安装此目录下的文件:", source.url, "distrib/<架构>/"); chsrc_note2 (prev); - char *cmd = xy_strjoin (3, "sed -i \"s#https\?://mirror.msys2.org/#", + char *cmd = xy_strcat (3, "sed -i \"s#https\?://mirror.msys2.org/#", source.url, "#g\" /etc/pacman.d/mirrorlist* "); diff --git a/src/recipe/ware/Anaconda/Anaconda.c b/src/recipe/ware/Anaconda/Anaconda.c index 6ac92a5..f9740fb 100644 --- a/src/recipe/ware/Anaconda/Anaconda.c +++ b/src/recipe/ware/Anaconda/Anaconda.c @@ -61,7 +61,7 @@ wr_anaconda_setsrc (char *option) char *w = xy_str_gsub (RAWSTR_wr_anaconda_condarc, "@1@", source.url); /* Windows 也是在这里 */ - char *configfile = xy_2strjoin (xy_os_home, "/.condarc"); + char *configfile = xy_2strcat (xy_os_home, "/.condarc"); if (xy_on_windows) { @@ -78,7 +78,7 @@ wr_anaconda_setsrc (char *option) } } - chsrc_note2 (xy_strjoin (3, "请向 ", configfile, " 中手动添加:")); + chsrc_note2 (xy_strcat (3, "请向 ", configfile, " 中手动添加:")); println (w); chsrc_note2 ("然后运行 conda clean -i 清除索引缓存,保证用的是镜像站提供的索引"); diff --git a/src/recipe/ware/CocoaPods.c b/src/recipe/ware/CocoaPods.c index 1483dba..3a071da 100644 --- a/src/recipe/ware/CocoaPods.c +++ b/src/recipe/ware/CocoaPods.c @@ -45,12 +45,12 @@ wr_cocoapods_setsrc (char *option) chsrc_note2 ("请手动执行以下命令:"); p("cd ~/.cocoapods/repos"); p("pod repo remove master"); - char *git_cmd = xy_strjoin (3, "git clone ", source.url, " master"); + char *git_cmd = xy_strcat (3, "git clone ", source.url, " master"); p(git_cmd); br(); chsrc_note2 ("最后进入项目工程目录,在Podfile中第一行加入:"); - char *source_str = xy_strjoin (3, "source '", source.url, "'"); + char *source_str = xy_strcat (3, "source '", source.url, "'"); p(source_str); chsrc_determine_chgtype (ChgType_Manual); diff --git a/src/recipe/ware/Docker/Docker.c b/src/recipe/ware/Docker/Docker.c index 8c7d8c8..66b18ae 100644 --- a/src/recipe/ware/Docker/Docker.c +++ b/src/recipe/ware/Docker/Docker.c @@ -118,7 +118,7 @@ wr_docker_setsrc (char *option) /* 不存在 /etc/docker/daemon.json 时可以直接写入文件 */ chsrc_alert2 ("未找到Docker配置文件, 将自动创建"); chsrc_ensure_dir ("/etc/docker"); - chsrc_run ( xy_2strjoin ("touch ", WR_Docker_ConfigFile), RunOpt_Default); + chsrc_run ( xy_2strcat ("touch ", WR_Docker_ConfigFile), RunOpt_Default); chsrc_append_to_file (to_add, WR_Docker_ConfigFile); } diff --git a/src/recipe/ware/Flatpak.c b/src/recipe/ware/Flatpak.c index 7a010d4..9492653 100644 --- a/src/recipe/ware/Flatpak.c +++ b/src/recipe/ware/Flatpak.c @@ -69,7 +69,7 @@ wr_flatpak_setsrc (char *option) use_this_source(wr_flatpak); chsrc_alert2 ("若出现问题,可先调用以下命令:"); - char *note = xy_strjoin (3, + char *note = xy_strcat (3, "wget ", source.url, "/flathub.gpg\n" "flatpak remote-modify --gpg-import=flathub.gpg flathub" ); @@ -80,7 +80,7 @@ wr_flatpak_setsrc (char *option) "尝试运行 flatpak remote-modify flathub --url=https://flathub.org/repo"; say (repo_note); - char *cmd = xy_2strjoin ("flatpak remote-modify flathub --url=", source.url); + char *cmd = xy_2strcat ("flatpak remote-modify flathub --url=", source.url); chsrc_run (cmd, RunOpt_Default); chsrc_determine_chgtype (ChgType_Auto); diff --git a/src/recipe/ware/Guix.c b/src/recipe/ware/Guix.c index ec37298..f5f2f60 100644 --- a/src/recipe/ware/Guix.c +++ b/src/recipe/ware/Guix.c @@ -41,7 +41,7 @@ wr_guix_setsrc (char *option) { use_this_source(wr_guix); - char *file = xy_strjoin (3, "(list (channel\n" + char *file = xy_strcat (3, "(list (channel\n" " (inherit (car %default-channels))\n" " (url \"", source.url, "\")))"); diff --git a/src/recipe/ware/Nix.c b/src/recipe/ware/Nix.c index 1fa010f..83d1dad 100644 --- a/src/recipe/ware/Nix.c +++ b/src/recipe/ware/Nix.c @@ -54,19 +54,19 @@ wr_nix_setsrc (char *option) use_this_source(wr_nix); - char *cmd = xy_strjoin (3, "nix-channel --add ", source.url, "nixpkgs-unstable nixpkgs"); + char *cmd = xy_strcat (3, "nix-channel --add ", source.url, "nixpkgs-unstable nixpkgs"); chsrc_run (cmd, RunOpt_Default); - char *w = xy_strjoin (3, "substituters = ", source.url, "store https://cache.nixos.org/"); + char *w = xy_strcat (3, "substituters = ", source.url, "store https://cache.nixos.org/"); chsrc_append_to_file (w, "~/.config/nix/nix.conf"); chsrc_run ("nix-channel --update", RunOpt_Default); chsrc_note2 ("若你使用的是NixOS,请确认你的系统版本(如22.11),并手动运行:"); - cmd = xy_strjoin (3, "nix-channel --add ", source.url, "nixpkgs- nixpkgs"); + cmd = xy_strcat (3, "nix-channel --add ", source.url, "nixpkgs- nixpkgs"); p(cmd); - cmd = xy_strjoin (3, "nix.settings.substituters = [ \"", source.url, "store\" ];"); + cmd = xy_strcat (3, "nix.settings.substituters = [ \"", source.url, "store\" ];"); chsrc_note2 ("若你使用的是NixOS,请额外添加下述内容至 configuration.nix 中"); p(cmd); diff --git a/src/recipe/ware/TeX-Live.c b/src/recipe/ware/TeX-Live.c index 0bd25d4..800fe39 100644 --- a/src/recipe/ware/TeX-Live.c +++ b/src/recipe/ware/TeX-Live.c @@ -91,14 +91,14 @@ wr_tex_setsrc (char *option) if (tlmgr_exist) { - cmd = xy_2strjoin ("tlmgr option repository ", source.url); + cmd = xy_2strcat ("tlmgr option repository ", source.url); chsrc_run (cmd, RunOpt_Default); } if (mpm_exist) { - char *miktex_url = xy_2strjoin (xy_str_delete_suffix (source.url, "texlive/tlnet"), "win32/miktex/tm/packages/"); - cmd = xy_2strjoin ("mpm --set-repository=", miktex_url); + char *miktex_url = xy_2strcat (xy_str_delete_suffix (source.url, "texlive/tlnet"), "win32/miktex/tm/packages/"); + cmd = xy_2strcat ("mpm --set-repository=", miktex_url); chsrc_run (cmd, RunOpt_Default); } diff --git a/src/recipe/ware/WinGet.c b/src/recipe/ware/WinGet.c index c37328c..4867950 100644 --- a/src/recipe/ware/WinGet.c +++ b/src/recipe/ware/WinGet.c @@ -52,7 +52,7 @@ wr_winget_setsrc (char *option) chsrc_run ("winget source remove winget", RunOpt_Dont_Abort_On_Failure); // 2025.8.18 执行两次相同的命令后继续设置,无报错,换源成功。具体原因不明 chsrc_run ("winget source remove winget", RunOpt_Dont_Abort_On_Failure); - chsrc_run (xy_strjoin (3, "winget source add winget ", source.url, " --trust-level trusted"), RunOpt_Default); + chsrc_run (xy_strcat (3, "winget source add winget ", source.url, " --trust-level trusted"), RunOpt_Default); chsrc_determine_chgtype (ChgType_Auto); chsrc_conclude (&source); diff --git a/test/fw.c b/test/fw.c index efad9af..a391d93 100644 --- a/test/fw.c +++ b/test/fw.c @@ -62,7 +62,7 @@ main (int argc, char const *argv[]) chsrc_overwrite_file ("overwrite", bkup); chsrc_view_file (bkup); - chsrc_log (xy_2strjoin ("CPU arch = ", chsrc_get_cpuarch ())); + chsrc_log (xy_2strcat ("CPU arch = ", chsrc_get_cpuarch ())); print ("chsrc: CPU cores = "); println (chsrc_get_cpucore ()); From 98516e0f4da12d88d0162b2553cdf3d1bd313706 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 18:35:58 +0800 Subject: [PATCH 049/103] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=A3=8E=E6=A0=BC=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/03-为什么拒绝使用代码格式化工具.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/03-为什么拒绝使用代码格式化工具.md b/doc/03-为什么拒绝使用代码格式化工具.md index 56589b5..a258066 100644 --- a/doc/03-为什么拒绝使用代码格式化工具.md +++ b/doc/03-为什么拒绝使用代码格式化工具.md @@ -6,7 +6,7 @@ ! Doc Authors : 曾奥然 ! Contributors : Nul None ! Created On : <2025-08-10> - ! Last Modified : <2025-08-18> + ! Last Modified : <2025-08-20> ! ---------------------------------------------------------- --> # chsrc 代码风格 @@ -88,11 +88,14 @@ if (!matched) matched = iterate_menu (chsrc_wr_menu, input, &target_tmp); - 整体上基于 `GNU style`,但我们坚持自己的美学原则,在细节上有所改进 -- 类型名: `PascalCase_t` +- 类型名: `PascalCase_t`,即 `UpperCamelCase_t` - 函数定义和调用时,**函数名和`()`之间始终保持一个空格**,如果是在宏中,可紧凑一些,无硬性规定 -- 函数和函数定义之间保持**2个空行**,若一系列函数和一系列函数存在主题性区别,**可用3个空行** +- 函数和函数定义之间**一般保持2个空行** + + - 若函数之间有高度关联性,**可用1个空行** + - 若一系列函数和一系列函数存在主题性区别,**可用3个空行**
From f1957094937fdd5fc330ecdaf0a9ff26afce5e08 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 19:49:01 +0800 Subject: [PATCH 050/103] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=20`xy=5Frun=5Fcaptur?= =?UTF-8?q?e()`=20[GitHub=20#268=20#269]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 38 ++++++++++++++++++++++++++++++++++++++ test/xy.c | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/lib/xy.h b/lib/xy.h index e02dabf..72ffe3d 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -815,6 +815,44 @@ xy_run (const char *cmd, unsigned long n) } +/** + * @brief 捕获命令的输出 + * + * @param[in] cmd 要执行的命令 + * @param[out] output 捕获的标准输出 + * + * @return 返回命令的执行状态 + */ +static int +xy_run_capture (const char *cmd, char **output) +{ + int cap = 8192; /* 假如1行100个字符,大约支持80行输出 */ + char *buf = (char *) xy_malloc0 (cap); + + FILE *stream = popen (cmd, "r"); + if (stream == NULL) + { + fprintf (stderr, "xy: 命令执行失败\n"); + return -1; + } + + int size = 0; + size_t n; + while ((n = fread (buf + size, 1, cap - size, stream)) > 0) { + size += n; + if (size == cap) + { + cap *= 2; + char *new_buf = realloc (buf, cap); + buf = new_buf; + } + } + buf[size] = '\0'; + + int status = pclose (stream); + *output = buf; + return status; +} /****************************************************** diff --git a/test/xy.c b/test/xy.c index 57d63fc..a78a1b7 100644 --- a/test/xy.c +++ b/test/xy.c @@ -28,7 +28,7 @@ print_str_for_map (const char *key, void *value) int main (int argc, char const *argv[]) { - xy_useutf8 (); + xy_use_utf8 (); println (xy_os_depend_str ("Hello, Windows!", "Hello, Unix!")); From 7d230bcf57e8ee42d06d3581f87e52886b0e54a0 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 19:52:54 +0800 Subject: [PATCH 051/103] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=E4=B8=BA=20?= =?UTF-8?q?`xy=5Frun=5Fiter=5Flines()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 20 ++++++++++---------- src/recipe/lang/Ruby/Ruby.c | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index 72ffe3d..b959e4c 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -761,20 +761,20 @@ _xy_log_brkt (int level, const char *prompt1, const char *prompt2, const char *c ******************************************************/ /** - * @brief 执行cmd,返回某行输出结果,并对已经遍历过的行执行iter_func + * @brief 执行 `cmd`,返回某行输出结果,并对已经遍历过的行执行 `func` * - * @param cmd 要执行的命令 - * @param n 指定命令执行输出的结果行中的某一行,0 表示最后一行,n (n>0) 表示第n行 - * @param iter_func 对遍历时经过的行的内容,进行函数调用 + * @param cmd 要执行的命令 + * @param n 指定命令执行输出的结果行中的某一行,0 表示最后一行,n (n>0) 表示第n行 + * @param func 对遍历时经过的行的内容,进行函数调用 * - * @return 该函数会返回 参数 n 指定的该行的内容 + * @return 返回第 `n` 行的内容 * * @note 返回的字符串最后面一般有换行符号 * - * 由于目标行会被返回出来,所以 iter_func() 并不执行目标行,只会执行遍历过的行 + * 由于目标行会被返回出来,所以 `func` 并不执行目标行,只会执行遍历过的行 */ static char * -xy_run_iter (const char *cmd, unsigned long n, void (*iter_func) (const char *)) +xy_run_iter_lines (const char *cmd, unsigned long n, void (*func) (const char *)) { const int size = 512; char *buf = (char *) malloc (size); @@ -798,9 +798,9 @@ xy_run_iter (const char *cmd, unsigned long n, void (*iter_func) (const char * count += 1; if (n == count) break; - if (iter_func) + if (func) { - iter_func (buf); + func (buf); } } @@ -811,7 +811,7 @@ xy_run_iter (const char *cmd, unsigned long n, void (*iter_func) (const char * static char * xy_run (const char *cmd, unsigned long n) { - return xy_run_iter (cmd, n, NULL); + return xy_run_iter_lines (cmd, n, NULL); } diff --git a/src/recipe/lang/Ruby/Ruby.c b/src/recipe/lang/Ruby/Ruby.c index bc7e7d4..4542ef4 100644 --- a/src/recipe/lang/Ruby/Ruby.c +++ b/src/recipe/lang/Ruby/Ruby.c @@ -76,7 +76,7 @@ pl_ruby_setsrc (char *option) char *cmd = NULL; // step1 - xy_run_iter ("gem sources -l", 0, pl_ruby_remove_gem_source); + xy_run_iter_lines ("gem sources -l", 0, pl_ruby_remove_gem_source); cmd = xy_2strcat ("gem source -a ", source.url); chsrc_run (cmd, RunOpt_Default); From 4a5aba91405d9539c47aaf78b9ec538da9ff0d82 Mon Sep 17 00:00:00 2001 From: HeZongLun <13425468+hezonglun@user.noreply.gitee.com> Date: Wed, 20 Aug 2025 19:29:23 +0800 Subject: [PATCH 052/103] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=20Perl=20?= =?UTF-8?q?=E7=9A=84=E5=AE=98=E6=96=B9=E9=95=9C=E5=83=8F=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/recipe/lang/Perl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/recipe/lang/Perl.c b/src/recipe/lang/Perl.c index be2f19d..22890da 100644 --- a/src/recipe/lang/Perl.c +++ b/src/recipe/lang/Perl.c @@ -24,7 +24,7 @@ pl_perl_prelude () chef_allow_user_define(this); def_sources_begin() - {&UpstreamProvider, NULL, DelegateToUpstream}, + {&UpstreamProvider, "https://www.cpan.org/", DelegateToUpstream}, {&Bfsu, "https://mirrors.bfsu.edu.cn/CPAN/", DelegateToMirror}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CPAN/", DelegateToMirror}, {&Bjtu, "https://mirror.bjtu.edu.cn/cpan/", DelegateToMirror}, From 3d8a98a2a937d14704ffa2bf756154b690b8f7be Mon Sep 17 00:00:00 2001 From: HeZongLun Date: Wed, 20 Aug 2025 12:14:39 +0000 Subject: [PATCH 053/103] =?UTF-8?q?update=20src/chsrc-main.c.=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=20HeZongLun=20=E7=9A=84=E8=B4=A1=E7=8C=AE?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: HeZongLun --- src/chsrc-main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 01b0f57..47e6313 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -51,6 +51,7 @@ chsrc_register_contributors () chef_register_contributor ("@Mikachu2333", "Mikachu2333", "mikachu.23333@zohomail.com", NULL); chef_register_contributor ("@techoc", "Rui Yang", "techoc@foxmail.com", NULL); chef_register_contributor ("@BingChunMoLi", "BingChunMoLi", "bingchunmoli@bingchunmoli.com", NULL); + chef_register_contributor ("@hezonglun", "HeZongLun", "hezonglun123456@outlook.com", NULL); } #include "recipe/menu.c" From 9d7543b681ca2295075ffc69d36f1824412113ea Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 21:53:22 +0800 Subject: [PATCH 054/103] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 8 ++++---- src/chsrc-main.c | 34 +++++++++++++++++++++++++++++++--- src/recipe/lang/Perl.c | 1 + 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index b959e4c..97f3e75 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -1,10 +1,10 @@ /** ------------------------------------------------------------ - * Copyright © 2023-2025 Aoran Zeng, Heng Guo + * Copyright © 2023-2025 曾奥然, 郭恒 * SPDX-License-Identifier: MIT * ------------------------------------------------------------- - * Lib Authors : 曾奥然 - * | 郭恒 <2085471348@qq.com> - * Contributors : juzeon + * Lib Authors : 曾奥然 + * | 郭恒 <2085471348@qq.com> + * Contributors : juzeon * | Mikachu2333 * | * Created On : <2023-08-28> diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 47e6313..2883c50 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -3,13 +3,41 @@ * SPDX-License-Identifier: GPL-3.0-or-later * ------------------------------------------------------------- * - * chsrc: Change Source + * chsrc: Change Source * - * 全平台通用换源工具与框架 + * 全平台通用换源工具与框架 * + * Change Source everywhere for every software + * + * 项目创建者: 曾奥然, 郭恒 + * ------------------------------------------------------------- + * + * 这是一个高度依靠贡献者的项目,我们直接把每一位贡献者写进了代码 + * 里,这是比 Git commit 更加稳定的方式。但我们不满足于把大家写在 + * 注释里,因为C语言在编译时会无情地把这些信息抹去。 + * + * 所以,我们让每一位贡献者直接参与运行时! + * + * 想象一下,每一位贡献者都化作一串比特: + * 栖居在内蒙古与贵州的数据中心中; + * 穿梭于北京与上海的机房; + * 流淌在广东、浙江的云里; + * 散布于四川与重庆的算力集群; + * 潜藏在陕西、甘肃、宁夏的机架之间; + * 分身于全国各地的桌面电脑里,点亮在湖北、山东、河南的家庭宽带 + * 上,跃动在江苏、安徽、湖南的手机与路由器中,乃至潜入那些无名的 + * 小型嵌入式设备。 + * + * 每当 chsrc 执行一次 recipe 相关的操作,这些比特便会复苏,贡献者 + * 的信息随之浮现。它提醒着使用者:在你与开源世界的每一次交互背后, + * 都是无数人的心血,跨越省份与疆域,以代码相连,持续回响。 + * + * 我们希望营造像 Richard Stallman 在创建 GNU 项目之前,在 MIT 时 + * 那样的氛围 —— 写自己用得上的软件,与大家一起开发、维护,简单纯 + * 粹,无关商业利益。就像小区、校园自发组建的足球篮球队,从一次偶 + * 然的加入,逐渐成长为互相支持的伙伴。 * ------------------------------------------------------------*/ -#define Chsrc_Initial_Date "2023-08-28" #define Chsrc_Version "0.2.2.3-dev5" #define Chsrc_Release_Date "2025/08/20" #define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc" diff --git a/src/recipe/lang/Perl.c b/src/recipe/lang/Perl.c index 22890da..16f61ec 100644 --- a/src/recipe/lang/Perl.c +++ b/src/recipe/lang/Perl.c @@ -18,6 +18,7 @@ pl_perl_prelude () chef_set_chef (this, NULL, NULL); chef_set_cooks (this, 0); chef_set_contributors (this, 0); + // TODO: 添加 @hezonglun chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); From e6d512eb838215d6028d4042591a8fec411f207b Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 22:05:07 +0800 Subject: [PATCH 055/103] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=E4=B8=BA=20?= =?UTF-8?q?`XY=5FBuild=5FOn=5Fxx`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/03-为什么拒绝使用代码格式化工具.md | 2 +- lib/xy.h | 19 +++++++++++++------ src/framework/core.c | 8 ++++---- src/recipe/lang/Python/uv.c | 2 +- src/recipe/lang/Rust/rustup.c | 2 +- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/doc/03-为什么拒绝使用代码格式化工具.md b/doc/03-为什么拒绝使用代码格式化工具.md index a258066..08991d7 100644 --- a/doc/03-为什么拒绝使用代码格式化工具.md +++ b/doc/03-为什么拒绝使用代码格式化工具.md @@ -70,7 +70,7 @@ if (!matched) matched = iterate_menu (chsrc_wr_menu, input, &target_tmp); ```c #ifdef _WIN32 - #define XY_On_Windows 1 + #define XY_Build_On_Windows 1 #define xy_on_windows true #ifdef XY_DEBUG #define xy_debug_mode 1 diff --git a/lib/xy.h b/lib/xy.h index 97f3e75..af6d42f 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -62,7 +62,8 @@ bool xy_enable_color = true; // #define NDEBUG #ifdef _WIN32 - #define XY_On_Windows 1 + #define XY_Build_On_Windows 1 + #define xy_on_windows true #define xy_on_linux false #define xy_on_macos false @@ -73,7 +74,9 @@ bool xy_enable_color = true; #define xy_use_utf8() SetConsoleOutputCP (65001) #elif defined(__linux__) || defined(__linux) - #define XY_On_Linux 1 + #define XY_Build_On_Linux 1 + #define XY_Build_On_Unix 1 + #define xy_on_windows false #define xy_on_linux true #define xy_on_macos false @@ -82,7 +85,9 @@ bool xy_enable_color = true; #define xy_use_utf8() #elif defined(__APPLE__) - #define XY_On_macOS 1 + #define XY_Build_On_macOS 1 + #define XY_Build_On_Unix 1 + #define xy_on_windows false #define xy_on_linux false #define xy_on_macos true @@ -91,7 +96,9 @@ bool xy_enable_color = true; #define xy_use_utf8() #elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) - #define XY_On_BSD 1 + #define XY_Build_On_BSD 1 + #define XY_Build_On_Unix 1 + #define xy_on_windows false #define xy_on_linux false #define xy_on_macos false @@ -916,7 +923,7 @@ _xy_os_home () static char * _xy_win_documents () { -#ifdef XY_On_Windows +#ifdef XY_Build_On_Windows char documents_path[MAX_PATH]; HRESULT result = SHGetFolderPathA (NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, documents_path); @@ -1009,7 +1016,7 @@ xy_dir_exist (const char *path) if (xy_on_windows) { -#ifdef XY_On_Windows +#ifdef XY_Build_On_Windows // 也可以用 opendir() #include DWORD attr = GetFileAttributesA (dir); diff --git a/src/framework/core.c b/src/framework/core.c index dcfae7c..360d523 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -1338,7 +1338,7 @@ chsrc_run_as_a_service (const char *cmd) FILE * chsrc_make_tmpfile (char *filename, char *postfix, bool loud, char **tmpfilename) { -#ifdef XY_On_Windows +#ifdef XY_Build_On_Windows /** * Windows 上没有 mkstemps(),只有 mkstemp() 和 _mktemp_s(),这后两者效果是等价的,只不过传参不同, * 这意味着我们无法给一个文件名后缀(postfix),只能生成一个临时文件名 @@ -1489,7 +1489,7 @@ chsrc_view_env (const char *var1, ...) bool first = true; while (var) { -#ifdef XY_On_Windows +#ifdef XY_Build_On_Windows if (first) { cmd = xy_strcat (3, "set ", var, " "); @@ -1757,7 +1757,7 @@ chsrc_get_cpuarch () char *ret; char *msg; -#if XY_On_Windows +#if XY_Build_On_Windows SYSTEM_INFO info; GetSystemInfo (&info); WORD num = info.wProcessorArchitecture; @@ -1810,7 +1810,7 @@ chsrc_get_cpucore () { int cores = 2; -#if XY_On_Windows +#if XY_Build_On_Windows SYSTEM_INFO info; GetSystemInfo (&info); DWORD num = info.dwNumberOfProcessors; diff --git a/src/recipe/lang/Python/uv.c b/src/recipe/lang/Python/uv.c index a8dff93..2a47c0c 100644 --- a/src/recipe/lang/Python/uv.c +++ b/src/recipe/lang/Python/uv.c @@ -125,7 +125,7 @@ pl_python_uv_setsrc (char *option) const char *source_content = xy_str_gsub (RAWSTR_pl_python_uv_config_source_content, "@url@", source.url); -#if defined(XY_On_macOS) || defined(XY_On_BSD) +#if defined(XY_Build_On_macOS) || defined(XY_Build_On_BSD) char *sed_cmd = "sed -i '' "; #else char *sed_cmd = "sed -i "; diff --git a/src/recipe/lang/Rust/rustup.c b/src/recipe/lang/Rust/rustup.c index 7f9fbe2..cba0bf4 100644 --- a/src/recipe/lang/Rust/rustup.c +++ b/src/recipe/lang/Rust/rustup.c @@ -62,7 +62,7 @@ pl_rust_rustup_setsrc (char *option) { use_this_source(pl_rust_rustup); -#ifdef XY_On_Windows +#ifdef XY_Build_On_Windows char *cmd1 = xy_strcat (3, "setx RUSTUP_DIST_SERVER \"", source.url, "\""); char *cmd2 = xy_strcat (3, "setx RUSTUP_UPDATE_ROOT \"", source.url, "/rustup\""); From 98b2e14747b0ce0d47f41fe3856eae6c45786ada Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 00:14:02 +0800 Subject: [PATCH 056/103] =?UTF-8?q?=E5=8A=A8=E6=80=81=E6=A3=80=E6=B5=8B=20?= =?UTF-8?q?OS=20=E4=BB=A5=E5=8F=8A=E6=B7=BB=E5=8A=A0=20`xy=5Finit()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 146 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 114 insertions(+), 32 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index af6d42f..ea1dc32 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -8,7 +8,7 @@ * | Mikachu2333 * | * Created On : <2023-08-28> - * Last Modified : <2025-08-20> + * Last Modified : <2025-08-21> * * * xy: 襄阳、咸阳 @@ -22,7 +22,7 @@ #ifndef XY_H #define XY_H -#define _XY_Version "v0.1.7.0-2025/08/20" +#define _XY_Version "v0.1.7.0-2025/08/21" #define _XY_Maintain_URL "https://github.com/RubyMetric/chsrc/blob/dev/lib/xy.h" #define _XY_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc/blob/dev/lib/xy.h" @@ -44,6 +44,7 @@ #include #include #include +#include // opendir() closedir() #if defined(__STDC__) && __STDC_VERSION__ >= 202311 #define XY_Deprecate_This(msg) [[deprecated(msg)]] @@ -56,55 +57,37 @@ #endif -/* Global */ +/* 全局变量 */ bool xy_enable_color = true; +/* 由 xy_init() 赋值 */ +bool xy_on_windows = false; +bool xy_on_linux = false; +bool xy_on_macos = false; +bool xy_on_bsd = false; +bool xy_on_android = false; + +char *xy_os_devnull = NULL; + // #define NDEBUG #ifdef _WIN32 #define XY_Build_On_Windows 1 - #define xy_on_windows true - #define xy_on_linux false - #define xy_on_macos false - #define xy_on_bsd false - #define xy_os_devnull "nul" #include #include - #define xy_use_utf8() SetConsoleOutputCP (65001) #elif defined(__linux__) || defined(__linux) #define XY_Build_On_Linux 1 #define XY_Build_On_Unix 1 - #define xy_on_windows false - #define xy_on_linux true - #define xy_on_macos false - #define xy_on_bsd false - #define xy_os_devnull "/dev/null" - #define xy_use_utf8() - #elif defined(__APPLE__) #define XY_Build_On_macOS 1 #define XY_Build_On_Unix 1 - #define xy_on_windows false - #define xy_on_linux false - #define xy_on_macos true - #define xy_on_bsd false - #define xy_os_devnull "/dev/null" - #define xy_use_utf8() - #elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) #define XY_Build_On_BSD 1 #define XY_Build_On_Unix 1 - - #define xy_on_windows false - #define xy_on_linux false - #define xy_on_macos false - #define xy_on_bsd true - #define xy_os_devnull "/dev/null" - #define xy_use_utf8() #endif #define assert_str(a, b) assert (xy_streql ((a), (b))) @@ -661,7 +644,7 @@ _xy_log (int level, const char *prompt, const char *content) } else { - // xy_assert ("CAN'T REACH!"); + xy_unreached(); } if (to_stderr) @@ -747,7 +730,7 @@ _xy_log_brkt (int level, const char *prompt1, const char *prompt2, const char *c } else { - // xy_assert ("CAN'T REACH!"); + xy_unreached(); } if (to_stderr) @@ -1110,6 +1093,105 @@ xy_parent_dir (const char *path) +void +xy_detect_os () +{ + // C: + char *drive = getenv ("SystemDrive"); + if (drive) + { + char path[256]; + snprintf (path, sizeof (path), "%s\\Users", drive); + DIR *d = opendir (path); + if (d) + { + xy_on_windows = true; + closedir (d); + return; + } + } + + FILE *fp = fopen ("/proc/version", "r"); + if (fp) + { + char buf[256] = {0}; + fread (buf, 1, sizeof(buf) - 1, fp); + fclose (fp); + if (strstr (buf, "Android")) + { + xy_on_android = true; + return; + } + else if (strstr (buf, "Linux")) + { + xy_on_linux = true; + return; + } + } + + /* 判断 macOS */ + DIR *d = opendir ("/System/Applications"); + if (d) + { + closedir (d); + d = opendir ("/Library/Apple"); + if (d) + { + xy_on_macos = true; + closedir (d); + } + } + + /* 最后判断 BSD */ + fp = popen ("uname -s", "r"); + if (!fp) + { + if (opendir ("/etc/rc.d")) + { + closedir (d); + xy_on_bsd = true; + return; + } + } + else + { + char buf[256]; + fgets (buf, sizeof (buf), fp); + pclose (fp); + if (strstr (buf, "BSD") != NULL) + xy_on_bsd = true; + } + + assert (xy_on_windows || xy_on_linux || xy_on_android || xy_on_macos || xy_on_bsd); +} + + +void +xy_use_utf8 () +{ +#ifdef XY_Build_On_Windows + SetConsoleOutputCP (65001); +#endif +} + + +/** + * @note 该函数必须被首先调用,方能使用各个跨操作系统的函数 + */ +void +xy_init () +{ + xy_detect_os (); + + if (xy_on_windows) + xy_os_devnull = "nul"; + else + xy_os_devnull = "/dev/null"; + + xy_use_utf8 (); +} + + /****************************************************** * Container ******************************************************/ From 224021f0f78d3fc045c27ab08199104d40ed2d03 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 00:15:38 +0800 Subject: [PATCH 057/103] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20xy=20=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/xy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/xy.c b/test/xy.c index a78a1b7..26f0826 100644 --- a/test/xy.c +++ b/test/xy.c @@ -5,7 +5,7 @@ * Test Authors : 曾奥然 * Contributors : Mikachu2333 * Created On : <2023-08-30> - * Last Modified : <2025-08-20> + * Last Modified : <2025-08-21> * * Test xy.h * ------------------------------------------------------------*/ @@ -28,7 +28,7 @@ print_str_for_map (const char *key, void *value) int main (int argc, char const *argv[]) { - xy_use_utf8 (); + xy_init (); println (xy_os_depend_str ("Hello, Windows!", "Hello, Unix!")); From 058fc62568377f7e159d5b403d9c5f29c8b91b09 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 00:18:52 +0800 Subject: [PATCH 058/103] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=E4=B8=BA=20?= =?UTF-8?q?`chsrc=5Fframework=5Finit()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chsrc-main.c | 4 ++-- src/framework/core.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 2883c50..328aa50 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -39,7 +39,7 @@ * ------------------------------------------------------------*/ #define Chsrc_Version "0.2.2.3-dev5" -#define Chsrc_Release_Date "2025/08/20" +#define Chsrc_Release_Date "2025/08/21" #define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc" #define Chsrc_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc" @@ -635,7 +635,7 @@ get_target (const char *input, TargetOp code, char *option) int main (int argc, char const *argv[]) { - chsrc_framework_prelude (); + chsrc_framework_init (); argc -= 1; diff --git a/src/framework/core.c b/src/framework/core.c index 360d523..19cd5be 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -9,7 +9,7 @@ * | Yangmoooo * | * Created On : <2023-08-29> - * Last Modified : <2025-08-20> + * Last Modified : <2025-08-21> * * chsrc framework * ------------------------------------------------------------*/ @@ -210,9 +210,9 @@ chsrc_alert2 (const char *str) void -chsrc_framework_prelude () +chsrc_framework_init () { - xy_use_utf8 (); + xy_init (); ProgStatus.contributors = xy_map_new (); } From f7f52691a713494c8496ce2cd39c5a18961fd29f Mon Sep 17 00:00:00 2001 From: HeZongLun <13425468+hezonglun@user.noreply.gitee.com> Date: Thu, 21 Aug 2025 10:43:37 +0800 Subject: [PATCH 059/103] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=20Clojure?= =?UTF-8?q?=E3=80=81R=20=E7=9A=84=E5=AE=98=E6=96=B9=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/recipe/lang/Clojure.c | 2 +- src/recipe/lang/R.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/recipe/lang/Clojure.c b/src/recipe/lang/Clojure.c index c3b0db7..d8ddfc1 100644 --- a/src/recipe/lang/Clojure.c +++ b/src/recipe/lang/Clojure.c @@ -24,7 +24,7 @@ pl_clojure_prelude () chef_allow_user_define(this); def_sources_begin() - {&UpstreamProvider, NULL, DelegateToUpstream}, + {&UpstreamProvider,"https://repo.clojars.org/", DelegateToUpstream}, {&MirrorZ, "https://mirrors.cernet.edu.cn/clojars/", DelegateToMirror}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/clojars/", DelegateToMirror}, {&Nju, "https://mirror.nju.edu.cn/clojars/", DelegateToMirror}, diff --git a/src/recipe/lang/R.c b/src/recipe/lang/R.c index 40ca1fe..7bbf3ed 100644 --- a/src/recipe/lang/R.c +++ b/src/recipe/lang/R.c @@ -25,7 +25,7 @@ pl_r_prelude () // 以下注释的,是不含有bioconductor的镜像站,我们在换cran的同时,也直接帮助用户换bioconductor def_sources_begin() - {&UpstreamProvider, NULL, DelegateToUpstream}, + {&UpstreamProvider, "https://cran.r-project.org/", DelegateToUpstream}, {&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/cran/", DelegateToMirror}, // {&Ali, "https://mirrors.aliyun.com/CRAN/", DelegateToMirror}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CRAN/", DelegateToMirror}, From 449da90daa69ab29d8343d6792f617184a6cdd54 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 16:04:09 +0800 Subject: [PATCH 060/103] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20`xy=5Fdeveloper=5F?= =?UTF-8?q?mistake()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/xy.h b/lib/xy.h index ea1dc32..edda060 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -96,7 +96,9 @@ char *xy_os_devnull = NULL; #define xy_unimplemented() assert(!"Unimplemented temporarily") #define xy_unreached() assert(!"This code shouldn't be reached") #define xy_noop() (void)0 -#define xy_cant_be_null(p) if(!p) assert(!"This pointer can't be null") +#define xy_cant_be_null(p) if(!p) assert(!"This pointer can't be null") +#define xy_developer_mistake(reason) assert(!reason) + static void _xy_print_int (int n) {printf ("%d", n);} static void _xy_print_long (long n) {printf ("%ld", n);} From 4ef5fc7f183297316b21d48f55ef043fec2289ff Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 16:25:52 +0800 Subject: [PATCH 061/103] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20`xy=5Fpanic()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index edda060..1cea7da 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -69,7 +69,6 @@ bool xy_on_android = false; char *xy_os_devnull = NULL; -// #define NDEBUG #ifdef _WIN32 #define XY_Build_On_Windows 1 @@ -90,14 +89,22 @@ char *xy_os_devnull = NULL; #define XY_Build_On_Unix 1 #endif + + +/** + * assert() 会被 NDEBUG 关闭,但我们也没有必要强制开启它,还是留给用户定义 + */ +// #undef NDEBUG +#define xy_noop() ((void)0) + #define assert_str(a, b) assert (xy_streql ((a), (b))) -#define xy_unsupported() assert(!"Unsuppoted") -#define xy_unimplemented() assert(!"Unimplemented temporarily") -#define xy_unreached() assert(!"This code shouldn't be reached") -#define xy_noop() (void)0 -#define xy_cant_be_null(p) if(!p) assert(!"This pointer can't be null") -#define xy_developer_mistake(reason) assert(!reason) +#define xy_panic(reason) assert(!reason) +#define xy_unsupported() xy_panic("Unsuppoted") +#define xy_unimplemented() xy_panic("Unimplemented temporarily") +#define xy_unreached() xy_panic("This code shouldn't be reached") +#define xy_cant_be_null(p) if(!p) xy_panic("This pointer can't be null") + static void _xy_print_int (int n) {printf ("%d", n);} @@ -130,7 +137,7 @@ static void _xy_println_const_str (const char *str) {printf ("%s\n", str);} bool: _xy_print_bool, \ char *: _xy_print_str, \ const char *: _xy_print_const_str, \ - default: assert(!"Unsupported type for print()!") \ + default: xy_panic("Unsupported type for print()!") \ )(x) /** @@ -145,7 +152,7 @@ static void _xy_println_const_str (const char *str) {printf ("%s\n", str);} bool: _xy_println_bool, \ char *: _xy_println_str, \ const char *: _xy_println_const_str, \ - default: assert(!"Unsupported type for println()/say()!") \ + default: xy_panic("Unsupported type for println()/say()!") \ )(x) /* @flavor Perl/Raku */ #define say println @@ -1164,7 +1171,8 @@ xy_detect_os () xy_on_bsd = true; } - assert (xy_on_windows || xy_on_linux || xy_on_android || xy_on_macos || xy_on_bsd); + if (!(xy_on_windows || xy_on_linux || xy_on_android || xy_on_macos || xy_on_bsd)) + xy_panic ("Unknown operating system"); } @@ -1271,7 +1279,7 @@ xy_seq_at (XySeq_t *seq, int n) { xy_cant_be_null (seq); - if (0 == n) assert (!"The index must begin from 1, not 0"); + if (0 == n) xy_panic ("The index must begin from 1, not 0"); if (1 == n) return seq->first_item ? seq->first_item->data : NULL; From 404807e69b0bacb5aeac5fe628d9cc281dbf50cd Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 16:46:16 +0800 Subject: [PATCH 062/103] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20`chsrc=5Fpanic()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/framework/core.c b/src/framework/core.c index 19cd5be..ebe41a4 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -161,6 +161,7 @@ ProgStatus = #define chsrc_debug(dom,str) #endif #define chsrc_verbose(str) xy_info(App_Name "(VERBOSE)",str) +#define chsrc_panic(reason) xy_error(App_Name "(PANIC)",reason); exit(Exit_MaintainerCause) #define faint(str) xy_str_to_faint(str) #define red(str) xy_str_to_red(str) From 79cbceb68361263a035efec1bf31f67688387f33 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 16:48:07 +0800 Subject: [PATCH 063/103] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20`chef=5Fverify=5Fc?= =?UTF-8?q?ontributor()`=20=E4=BB=A5=E5=8F=8A=20=E9=87=8D=E5=86=99=20`chef?= =?UTF-8?q?=5Fset=5Fchef()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/chef.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/framework/chef.c b/src/framework/chef.c index 66dd96f..591e84b 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -231,15 +231,33 @@ chef_set_authors (Target_t *target, size_t count, ...) } -void -chef_set_chef (Target_t *target, char *name, char *email) +/** + * @brief 验证该 `id` 所指的贡献者确有其人 + */ +Contributor_t * +chef_verify_contributor (const char *id) { - if (!target || !name || !email) - return; + xy_cant_be_null (id); - target->chef = xy_malloc0 (sizeof(Contributor_t)); - target->chef->name = xy_strdup (name); - target->chef->email = xy_strdup (email); + Contributor_t *c = xy_map_get (ProgStatus.contributors, id); + if (!c) + { + char error[256]; + snprintf (error, sizeof (error), "贡献者不存在: %s", id); + chsrc_panic (error); + } + return c; +} + + +void +chef_set_chef (Target_t *target, const char *id) +{ + xy_cant_be_null (target); + + Contributor_t *c = chef_verify_contributor (id); + + target->chef = c; } From c609a10988aa7ca1c2496e8bc1599c6237ab4110 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 17:16:33 +0800 Subject: [PATCH 064/103] =?UTF-8?q?=E5=88=A0=E9=99=A4=20`authors`=20?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=EF=BC=8C=E5=B0=86=E5=85=B6=E7=94=B1=20`cooks?= =?UTF-8?q?`=20=E4=BB=A3=E6=9B=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/chef.c | 126 ++++++++++++++++------------------------- src/framework/struct.h | 15 ++--- 2 files changed, 54 insertions(+), 87 deletions(-) diff --git a/src/framework/chef.c b/src/framework/chef.c index 591e84b..5dddf02 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -75,8 +75,11 @@ chef_set_sources_speed_measure_url_with_func ( char *(*func)(const char *url, const char *user_data), char *user_data) { + xy_cant_be_null (target); + Source_t *sources = target->sources; int n = target->sources_n; + for (int i=0; ican_english = true; } void chef_forbid_english (Target_t *target) { - if (!target) - return; - + xy_cant_be_null (target); target->can_english = false; } @@ -125,8 +124,7 @@ chef_forbid_english (Target_t *target) void chef_allow_local_mode (Target_t *target, Capability_t cap, const char *explain_zh, const char *explain_en) { - if (!target) - return; + xy_cant_be_null (target); target->cap_local = cap; @@ -149,8 +147,7 @@ chef_allow_local_mode (Target_t *target, Capability_t cap, const char *explain_z void chef_allow_user_define (Target_t *target) { - if (!target) - return; + xy_cant_be_null (target); target->can_user_define = true; target->can_user_define_explain = NULL; @@ -159,8 +156,7 @@ chef_allow_user_define (Target_t *target) void chef_forbid_user_define (Target_t *target) { - if (!target) - return; + xy_cant_be_null (target); target->can_user_define = false; @@ -173,63 +169,15 @@ chef_forbid_user_define (Target_t *target) void chef_set_note (Target_t *target, const char *note_zh, const char *note_en) { - if (!target) - return; + xy_cant_be_null (target); const char *msg = CHINESE ? note_zh : note_en; if (msg) - target->note = xy_strdup(msg); + target->note = xy_strdup (msg); } -void -chef_set_contributors (Target_t *target, uint32_t count, ...) -{ - if (!target || count==0) - return; - - target->contributors_n = count; - target->contributors = xy_malloc0 (count * sizeof(Contributor_t)); - - va_list args; - va_start(args, count); - - for (uint32_t i = 0; i < count; i++) - { - char *name = va_arg(args, char*); - char *email = va_arg(args, char*); - - target->contributors[i].name = xy_strdup (name); - target->contributors[i].email = xy_strdup (email); - } -} - - -void -chef_set_authors (Target_t *target, size_t count, ...) -{ - if (!target || count == 0) - return; - - va_list args; - va_start(args, count); - - target->authors = xy_malloc0 (count * sizeof(Contributor_t)); - target->authors_n = count; - - for (size_t i = 0; i < count; i++) - { - char *name = va_arg(args, char*); - char *email = va_arg(args, char*); - - target->authors[i].name = xy_strdup(name); - target->authors[i].email = xy_strdup(email); - } - - va_end(args); -} - /** * @brief 验证该 `id` 所指的贡献者确有其人 @@ -264,8 +212,7 @@ chef_set_chef (Target_t *target, const char *id) void chef_set_cooks (Target_t *target, size_t count, ...) { - if (!target) - return; + xy_cant_be_null (target); if (count == 0) { @@ -275,29 +222,52 @@ chef_set_cooks (Target_t *target, size_t count, ...) } va_list args; - va_start(args, count); + va_start (args, count); - target->cooks = xy_malloc0 (count * sizeof(Contributor_t)); + target->cooks = xy_malloc0 (count * sizeof (Contributor_t*)); target->cooks_n = count; for (size_t i = 0; i < count; i++) { - char *name = va_arg(args, char*); - char *email = va_arg(args, char*); - - target->cooks[i].name = xy_strdup(name); - target->cooks[i].email = xy_strdup(email); + char *id = va_arg (args, char*); + target->cooks[i] = chef_verify_contributor (id); } - va_end(args); + va_end (args); } +void +chef_set_contributors (Target_t *target, uint32_t count, ...) +{ + xy_cant_be_null (target); + + if (count == 0) + { + target->contributors = NULL; + target->contributors_n = 0; + return; + } + + va_list args; + va_start (args, count); + + target->contributors = xy_malloc0 (count * sizeof (Contributor_t*)); + target->contributors_n = count; + + for (uint32_t i = 0; i < count; i++) + { + char *id = va_arg (args, char*); + target->contributors[i] = chef_verify_contributor (id); + } +} + + void chef_set_created_on (Target_t *target, char *date) { - if (!target) - return; + xy_cant_be_null (target); + xy_cant_be_null (date); target->created_on = xy_strdup (date); } @@ -306,8 +276,8 @@ chef_set_created_on (Target_t *target, char *date) void chef_set_last_updated (Target_t *target, char *date) { - if (!target) - return; + xy_cant_be_null (target); + xy_cant_be_null (date); target->last_updated = xy_strdup (date); } @@ -316,8 +286,8 @@ chef_set_last_updated (Target_t *target, char *date) void chef_set_sources_last_updated (Target_t *target, char *date) { - if (!target) - return; + xy_cant_be_null (target); + xy_cant_be_null (date); target->sources_last_updated = xy_strdup (date); } diff --git a/src/framework/struct.h b/src/framework/struct.h index 031f1b5..7b2f50e 100644 --- a/src/framework/struct.h +++ b/src/framework/struct.h @@ -142,20 +142,17 @@ typedef struct Target_t char *note; /* 备注 */ - /* Recipe maintain info */ + /* recipe 维护信息 */ char *created_on; char *last_updated; char *sources_last_updated; - Contributor_t *authors; - size_t authors_n; + Contributor_t *chef; /* 该 recipe 的负责人 */ + Contributor_t **cooks; /* 该 recipe 的核心作者 */ + size_t cooks_n; - Contributor_t *contributors; - size_t contributors_n; - - Contributor_t *chef; /* Chef 仅有一个 */ - Contributor_t *cooks; /* Cook 可以有多个 */ - size_t cooks_n; + Contributor_t **contributors; /* 该 recipe 的所有贡献者(除核心作者外的其他人) */ + size_t contributors_n; } Target_t; From 6776e9a1a99ad2612b11d03a032f467284eafb51 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 17:46:54 +0800 Subject: [PATCH 065/103] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20wr=20=E4=B8=8E=20o?= =?UTF-8?q?s=20=E7=9A=84=20`chef=5Fset=5Fcooks()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/chef.c | 6 ++++++ src/recipe/lang/JavaScript/common.h | 5 +++-- src/recipe/lang/Python/common.h | 4 ++-- src/recipe/os/APT/Debian.c | 10 +++------- src/recipe/os/APT/Kali-Linux.c | 9 +++------ src/recipe/os/APT/Linux-Lite.c | 6 ++---- src/recipe/os/APT/Linux-Mint.c | 8 +++----- src/recipe/os/APT/ROS.c | 9 +++------ src/recipe/os/APT/Raspberry-Pi-OS.c | 8 +++----- src/recipe/os/APT/Termux.c | 5 ++--- src/recipe/os/APT/Trisquel.c | 5 ++--- src/recipe/os/APT/Ubuntu.c | 10 +++------- src/recipe/os/APT/deepin.c | 8 +++----- src/recipe/os/APT/openKylin.c | 8 +++----- src/recipe/os/Alpine-Linux.c | 8 +++----- src/recipe/os/BSD/FreeBSD.c | 5 ++--- src/recipe/os/BSD/NetBSD.c | 5 ++--- src/recipe/os/BSD/OpenBSD.c | 5 ++--- src/recipe/os/Gentoo-Linux.c | 8 +++----- src/recipe/os/OpenWrt.c | 9 +++------ src/recipe/os/Solus.c | 5 ++--- src/recipe/os/Void-Linux.c | 8 +++----- src/recipe/os/YUM/AlmaLinux.c | 8 +++----- src/recipe/os/YUM/Anolis-OS.c | 5 ++--- src/recipe/os/YUM/Fedora-Linux.c | 3 +-- src/recipe/os/YUM/Rocky-Linux.c | 8 +++----- src/recipe/os/YUM/openEuler.c | 11 +++-------- src/recipe/os/openSUSE.c | 8 +++----- src/recipe/os/pacman/Arch-Linux.c | 11 ++++------- src/recipe/os/pacman/MSYS2.c | 8 +++----- src/recipe/os/pacman/Manjaro-Linux.c | 5 ++--- src/recipe/recipe-template.c | 18 ++++++++---------- src/recipe/ware/Anaconda/Anaconda.c | 9 +++------ src/recipe/ware/CocoaPods.c | 5 ++--- src/recipe/ware/Docker/Docker.c | 7 ++----- src/recipe/ware/Emacs.c | 5 ++--- src/recipe/ware/Flatpak.c | 8 +++----- src/recipe/ware/Guix.c | 5 ++--- src/recipe/ware/Homebrew/Homebrew.c | 8 +++----- src/recipe/ware/Nix.c | 5 ++--- src/recipe/ware/TeX-Live.c | 8 +++----- src/recipe/ware/WinGet.c | 7 +++---- 42 files changed, 118 insertions(+), 188 deletions(-) diff --git a/src/framework/chef.c b/src/framework/chef.c index 5dddf02..2f4c89d 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -198,6 +198,9 @@ chef_verify_contributor (const char *id) } +/** + * @brief 设置 Chef (recipe 负责人) + */ void chef_set_chef (Target_t *target, const char *id) { @@ -209,6 +212,9 @@ chef_set_chef (Target_t *target, const char *id) } +/** + * @brief 设置 Cooks (recipe 核心作者) + */ void chef_set_cooks (Target_t *target, size_t count, ...) { diff --git a/src/recipe/lang/JavaScript/common.h b/src/recipe/lang/JavaScript/common.h index cb00110..6968249 100644 --- a/src/recipe/lang/JavaScript/common.h +++ b/src/recipe/lang/JavaScript/common.h @@ -22,8 +22,9 @@ pl_js_group_prelude (void) chef_set_sources_last_updated (this, "2025-07-11"); chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 1, "happy game", "happygame1024@gmail.com"); + + chef_set_chef (this, "@happy-game"); + chef_set_contributors (this,0); chef_allow_local_mode (this, PartiallyCan, diff --git a/src/recipe/lang/Python/common.h b/src/recipe/lang/Python/common.h index cdd68d8..e207304 100644 --- a/src/recipe/lang/Python/common.h +++ b/src/recipe/lang/Python/common.h @@ -30,8 +30,8 @@ pl_python_group_prelude (void) chef_set_sources_last_updated (this, "2025-07-11"); chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 1, "happy game", "happygame1024@gmail.com"); + + chef_set_chef (this, "@happy-game"); chef_set_contributors (this, 1, "yongxiang", "1926885268@qq.com"); diff --git a/src/recipe/os/APT/Debian.c b/src/recipe/os/APT/Debian.c index af0d76f..6a998f0 100644 --- a/src/recipe/os/APT/Debian.c +++ b/src/recipe/os/APT/Debian.c @@ -14,13 +14,9 @@ os_debian_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-07-11"); - chef_set_authors (this, 2, - "Aoran Zeng", "ccmywish@qq.com", - "Heng Guo", "2085471348@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Yangmoooo", "yangmoooo@outlook.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 2, "@ccmywish", "@G_I_Y"); + chef_set_contributors (this, 1, "@Yangmoooo"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/Kali-Linux.c b/src/recipe/os/APT/Kali-Linux.c index 341a7ba..9b5232e 100644 --- a/src/recipe/os/APT/Kali-Linux.c +++ b/src/recipe/os/APT/Kali-Linux.c @@ -14,12 +14,9 @@ os_kali_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-06-20"); - chef_set_authors (this, 1, "Heng Guo", "2085471348@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 2, - "Yangmoooo", "yangmoooo@outlook.com", - "Happy Game", "happygame1024@gmail.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@G_I_Y"); + chef_set_contributors (this, 2, "@Yangmoooo", "@happy-game"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/Linux-Lite.c b/src/recipe/os/APT/Linux-Lite.c index 4814c12..44aa657 100644 --- a/src/recipe/os/APT/Linux-Lite.c +++ b/src/recipe/os/APT/Linux-Lite.c @@ -14,11 +14,9 @@ os_linuxlite_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-11-21"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Yangmoooo", "yangmoooo@outlook.com"); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 1, "@Yangmoooo"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/Linux-Mint.c b/src/recipe/os/APT/Linux-Mint.c index d792935..a012c51 100644 --- a/src/recipe/os/APT/Linux-Mint.c +++ b/src/recipe/os/APT/Linux-Mint.c @@ -14,11 +14,9 @@ os_linuxmint_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-11-21"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Happy Game", "happygame1024@gmail.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 1, "@happy-game"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/ROS.c b/src/recipe/os/APT/ROS.c index 3745ba6..df1cdc9 100644 --- a/src/recipe/os/APT/ROS.c +++ b/src/recipe/os/APT/ROS.c @@ -14,12 +14,9 @@ os_ros_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-04-18"); - chef_set_authors (this, 1, "Heng Guo", "2085471348@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 2, - "Aoran Zeng", "ccmywish@qq.com", - "zouri", "guoshuaisun@outlook.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@G_I_Y"); + chef_set_contributors (this, 2, "@ccmywish", "@zouri"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/Raspberry-Pi-OS.c b/src/recipe/os/APT/Raspberry-Pi-OS.c index e7b111c..1e38150 100644 --- a/src/recipe/os/APT/Raspberry-Pi-OS.c +++ b/src/recipe/os/APT/Raspberry-Pi-OS.c @@ -16,11 +16,9 @@ os_raspberrypi_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2023-09-29"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Yangmoooo", "yangmoooo@outlook.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 1, "@Yangmoooo"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/Termux.c b/src/recipe/os/APT/Termux.c index 0c46a6b..08dd935 100644 --- a/src/recipe/os/APT/Termux.c +++ b/src/recipe/os/APT/Termux.c @@ -14,9 +14,8 @@ os_termux_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-03-04"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/os/APT/Trisquel.c b/src/recipe/os/APT/Trisquel.c index 9244764..935ba60 100644 --- a/src/recipe/os/APT/Trisquel.c +++ b/src/recipe/os/APT/Trisquel.c @@ -16,9 +16,8 @@ os_trisquel_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-11-21"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/os/APT/Ubuntu.c b/src/recipe/os/APT/Ubuntu.c index fd748d3..2454b0c 100644 --- a/src/recipe/os/APT/Ubuntu.c +++ b/src/recipe/os/APT/Ubuntu.c @@ -15,13 +15,9 @@ os_ubuntu_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-07-11"); - chef_set_authors (this, 2, - "Aoran Zeng", "ccmywish@qq.com", - "Heng Guo", "2085471348@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Zhao", "1792582687@qq.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 2, "@ccmywish", "@G_I_Y"); + chef_set_contributors (this, 1, "@Zhao"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/deepin.c b/src/recipe/os/APT/deepin.c index 0caba9f..95da89e 100644 --- a/src/recipe/os/APT/deepin.c +++ b/src/recipe/os/APT/deepin.c @@ -14,11 +14,9 @@ os_deepin_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-09-14"); - chef_set_authors (this, 1, "Heng Guo", "2085471348@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Yangmoooo", "yangmoooo@outlook.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@G_I_Y"); + chef_set_contributors (this, 1, "@Yangmoooo"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/openKylin.c b/src/recipe/os/APT/openKylin.c index 462fecf..742669b 100644 --- a/src/recipe/os/APT/openKylin.c +++ b/src/recipe/os/APT/openKylin.c @@ -17,11 +17,9 @@ os_openkylin_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2023-09-29"); - chef_set_authors (this, 1, "Heng Guo", "2085471348@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Aoran Zeng", "ccmywish@qq.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@G_I_Y"); + chef_set_contributors (this, 1, "@ccmywish"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/Alpine-Linux.c b/src/recipe/os/Alpine-Linux.c index faeb8a9..82ac21d 100644 --- a/src/recipe/os/Alpine-Linux.c +++ b/src/recipe/os/Alpine-Linux.c @@ -14,11 +14,9 @@ os_alpine_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-09-14"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Yangmoooo", "yangmoooo@outlook.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 1, "@Yangmoooo"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/os/BSD/FreeBSD.c b/src/recipe/os/BSD/FreeBSD.c index b4abd58..d30f9ac 100644 --- a/src/recipe/os/BSD/FreeBSD.c +++ b/src/recipe/os/BSD/FreeBSD.c @@ -14,9 +14,8 @@ os_freebsd_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2023-09-27"); - chef_set_authors (this, 2, "Aoran Zeng", "ccmywish@qq.com", "Heng Guo", "2085471348@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 2, "@ccmywish", "@G_I_Y"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/os/BSD/NetBSD.c b/src/recipe/os/BSD/NetBSD.c index 1660fae..3e7a4d1 100644 --- a/src/recipe/os/BSD/NetBSD.c +++ b/src/recipe/os/BSD/NetBSD.c @@ -14,9 +14,8 @@ os_netbsd_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-07-31"); - chef_set_authors (this, 2, "Aoran Zeng", "ccmywish@qq.com", "Heng Guo", "2085471348@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 2, "@ccmywish", "@G_I_Y"); chef_set_contributors (this, 0); diff --git a/src/recipe/os/BSD/OpenBSD.c b/src/recipe/os/BSD/OpenBSD.c index 2c50c13..5551e26 100644 --- a/src/recipe/os/BSD/OpenBSD.c +++ b/src/recipe/os/BSD/OpenBSD.c @@ -14,9 +14,8 @@ os_openbsd_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-07-31"); - chef_set_authors (this, 2, "Heng Guo", "2085471348@qq.com", "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 2, "@G_I_Y", "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/os/Gentoo-Linux.c b/src/recipe/os/Gentoo-Linux.c index 44685c9..6330cbe 100644 --- a/src/recipe/os/Gentoo-Linux.c +++ b/src/recipe/os/Gentoo-Linux.c @@ -14,11 +14,9 @@ os_gentoo_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-06-20"); - chef_set_authors (this, 1, "Heng Guo", "2085471348@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Aoran Zeng", "ccmywish@qq.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@G_I_Y"); + chef_set_contributors (this, 1, "@ccmywish"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/os/OpenWrt.c b/src/recipe/os/OpenWrt.c index 2f05ddc..71bb642 100644 --- a/src/recipe/os/OpenWrt.c +++ b/src/recipe/os/OpenWrt.c @@ -14,12 +14,9 @@ os_openwrt_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-12-14"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 2, - "Yangmoooo", "yangmoooo@outlook.com", - "happy game", "happygame1024@gmail.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 2, "@Yangmoooo", "@happy-game"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/os/Solus.c b/src/recipe/os/Solus.c index 482ddfb..6542b6f 100644 --- a/src/recipe/os/Solus.c +++ b/src/recipe/os/Solus.c @@ -14,9 +14,8 @@ os_solus_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2023-09-29"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); diff --git a/src/recipe/os/Void-Linux.c b/src/recipe/os/Void-Linux.c index efd8ca9..ba500af 100644 --- a/src/recipe/os/Void-Linux.c +++ b/src/recipe/os/Void-Linux.c @@ -14,11 +14,9 @@ os_voidlinux_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-12-18"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Yangmoooo", "yangmoooo@outlook.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 1, "@Yangmoooo"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/YUM/AlmaLinux.c b/src/recipe/os/YUM/AlmaLinux.c index c36a2a5..ffe950f 100644 --- a/src/recipe/os/YUM/AlmaLinux.c +++ b/src/recipe/os/YUM/AlmaLinux.c @@ -14,11 +14,9 @@ os_almalinux_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-12-18"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Yangmoooo", "yangmoooo@outlook.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 1, "@Yangmoooo"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/YUM/Anolis-OS.c b/src/recipe/os/YUM/Anolis-OS.c index 8624ab1..fe71399 100644 --- a/src/recipe/os/YUM/Anolis-OS.c +++ b/src/recipe/os/YUM/Anolis-OS.c @@ -14,9 +14,8 @@ os_anolis_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-06-12"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/os/YUM/Fedora-Linux.c b/src/recipe/os/YUM/Fedora-Linux.c index ec3dc60..88a374b 100644 --- a/src/recipe/os/YUM/Fedora-Linux.c +++ b/src/recipe/os/YUM/Fedora-Linux.c @@ -17,8 +17,7 @@ os_fedora_prelude () chef_set_authors (this, 2, "Heng Guo", "2085471348@qq.com", "happy game", "happygame1024@gmail.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 1, "happy game", "happygame1024@gmail.com"); + chef_set_chef (this, "@happy-game"); chef_set_contributors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); diff --git a/src/recipe/os/YUM/Rocky-Linux.c b/src/recipe/os/YUM/Rocky-Linux.c index 50b3cda..33d165a 100644 --- a/src/recipe/os/YUM/Rocky-Linux.c +++ b/src/recipe/os/YUM/Rocky-Linux.c @@ -14,11 +14,9 @@ os_rockylinux_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-06-20"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "happy game", "happygame1024@gmail.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 1, "@happy-game"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/YUM/openEuler.c b/src/recipe/os/YUM/openEuler.c index b53ba11..97c3db8 100644 --- a/src/recipe/os/YUM/openEuler.c +++ b/src/recipe/os/YUM/openEuler.c @@ -14,14 +14,9 @@ os_openeuler_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-06-20"); - chef_set_authors (this, 1, "Heng Guo", "2085471348@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 3, - "Aoran Zeng", "ccmywish@qq.com", - "Yangmoooo", "yangmoooo@outlook.com", - "happy game", "happygame1024@gmail.com"); - + chef_set_cooks (this, 1, "@G_I_Y"); + chef_set_chef (this, NULL); + chef_set_contributors (this, 3, "@ccmywish", "@Yangmoooo", "@happy-game"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/openSUSE.c b/src/recipe/os/openSUSE.c index 4811ff8..0f29fb0 100644 --- a/src/recipe/os/openSUSE.c +++ b/src/recipe/os/openSUSE.c @@ -14,11 +14,9 @@ os_opensuse_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-06-20"); - chef_set_authors (this, 1, "Heng Guo", "2085471348@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Aoran Zeng", "ccmywish@qq.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 2, "@ccmywish", "@G_I_Y"); + chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/pacman/Arch-Linux.c b/src/recipe/os/pacman/Arch-Linux.c index 59d4838..0faff53 100644 --- a/src/recipe/os/pacman/Arch-Linux.c +++ b/src/recipe/os/pacman/Arch-Linux.c @@ -19,8 +19,7 @@ os_arch_prelude () chef_set_authors (this, 2, "Aoran Zeng", "ccmywish@qq.com", "Heng Guo", "2085471348@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 1, "happy game", "happygame1024@gmail.com"); + chef_set_chef (this, "@happy-game"); chef_set_contributors (this, 1, "happy game", "happygame1024@gmail.com"); @@ -123,11 +122,9 @@ os_archlinuxcn_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-07-03"); - chef_set_authors (this, 2, "Aoran Zeng", "ccmywish@qq.com", "Heng Guo", "2085471348@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "happy game", "happygame1024@gmail.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 2, "@ccmywish", "@G_I_Y"); + chef_set_contributors (this, 1, "@happy-game"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/pacman/MSYS2.c b/src/recipe/os/pacman/MSYS2.c index 49456f2..5a2f245 100644 --- a/src/recipe/os/pacman/MSYS2.c +++ b/src/recipe/os/pacman/MSYS2.c @@ -14,11 +14,9 @@ os_msys2_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-06-20"); - chef_set_authors (this, 1, "Heng Guo", "2085471348@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Aoran Zeng", "ccmywish@qq.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@G_I_Y"); + chef_set_contributors (this, 1, "@ccmywish"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/pacman/Manjaro-Linux.c b/src/recipe/os/pacman/Manjaro-Linux.c index 75d5c70..2e918f2 100644 --- a/src/recipe/os/pacman/Manjaro-Linux.c +++ b/src/recipe/os/pacman/Manjaro-Linux.c @@ -13,9 +13,8 @@ os_manjaro_prelude () chef_set_created_on (this, "2023-09-06"); chef_set_last_updated (this, "2025-08-10"); - chef_set_authors (this, 1, "Heng Guo", "2085471348@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@G_I_Y"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/recipe-template.c b/src/recipe/recipe-template.c index 8fc28bb..41a1549 100644 --- a/src/recipe/recipe-template.c +++ b/src/recipe/recipe-template.c @@ -2,11 +2,11 @@ * SPDX-License-Identifier: GPL-3.0-or-later * ------------------------------------------------------------- * File Name : recipe-template.c - * File Authors : Aoran Zeng - * Contributors : Nil Null + * File Authors : 曾奥然 + * Contributors : Mikachu2333 * | * Created On : <2024-08-09> - * Last Modified : <2025-08-11> + * Last Modified : <2025-08-21> * ------------------------------------------------------------- * 本文件作为一个通用模板: * @@ -66,14 +66,12 @@ void chef_set_created_on (this, "2024-08-09"); // 文件创建日期 chef_set_last_updated (this, "2025-08-12"); // 文件最后一次更新日期 - chef_set_sources_last_updated (this, "2025-08-11"); // 镜像站点最后一次更新日期 - - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); // 作者 - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); // 想一直为它贡献和更新?将自己加在这里! - chef_set_contributors (this, 1, // 为它做了贡献?将自己的信息加在这里! - "Nil Null", "nil@null.org"); + chef_set_sources_last_updated (this, "2025-08-11"); // 镜像源最后一次更新日期 + chef_set_chef (this, "@ccmywish"); // recipe 负责人 + chef_set_cooks (this, 2, "@ccmywish", "@nilnull"); // recipe 核心作者 + // 做了贡献?将自己的信息加在这里! + chef_set_contributors (this, 2, "@nulnone", "@someone"); chef_allow_local_mode (this, PartiallyCan, "具体说明是否支持项目级换源...", "Tell users the local mode support"); diff --git a/src/recipe/ware/Anaconda/Anaconda.c b/src/recipe/ware/Anaconda/Anaconda.c index f9740fb..49cee41 100644 --- a/src/recipe/ware/Anaconda/Anaconda.c +++ b/src/recipe/ware/Anaconda/Anaconda.c @@ -16,12 +16,9 @@ wr_anaconda_prelude () chef_set_last_updated (this, "2025-08-09"); chef_set_sources_last_updated (this, "2025-07-14"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 2, - "Yangmoooo", "yangmoooo@outlook.com", - "yongxiang", "1926885268@qq.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 2, "@Yangmoooo", "@yongxiang"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/ware/CocoaPods.c b/src/recipe/ware/CocoaPods.c index 3a071da..abe815a 100644 --- a/src/recipe/ware/CocoaPods.c +++ b/src/recipe/ware/CocoaPods.c @@ -14,9 +14,8 @@ wr_cocoapods_prelude () chef_set_last_updated (this, "2025-08-09"); chef_set_sources_last_updated (this, "2025-07-13"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); diff --git a/src/recipe/ware/Docker/Docker.c b/src/recipe/ware/Docker/Docker.c index 66b18ae..7404153 100644 --- a/src/recipe/ware/Docker/Docker.c +++ b/src/recipe/ware/Docker/Docker.c @@ -31,11 +31,8 @@ wr_docker_prelude () chef_set_last_updated (this, "2025-08-09"); chef_set_sources_last_updated (this, "2025-07-14"); - chef_set_authors (this, 2, - "happy game", "happygame1024@gmail.com", - "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 1, "happy game", "happygame1024@gmail.com"); + chef_set_chef (this, "@happy-game"); + chef_set_cooks (this, 2, "@happy-game", "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/ware/Emacs.c b/src/recipe/ware/Emacs.c index 3e69010..0c97887 100644 --- a/src/recipe/ware/Emacs.c +++ b/src/recipe/ware/Emacs.c @@ -21,9 +21,8 @@ wr_emacs_prelude () chef_set_last_updated (this, "2025-08-09"); chef_set_sources_last_updated (this, "2025-07-13"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/ware/Flatpak.c b/src/recipe/ware/Flatpak.c index 9492653..56de2d0 100644 --- a/src/recipe/ware/Flatpak.c +++ b/src/recipe/ware/Flatpak.c @@ -14,11 +14,9 @@ wr_flatpak_prelude () chef_set_last_updated (this, "2025-08-09"); chef_set_sources_last_updated (this, "2025-05-27"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Jialin Lyu", "jialinlvcn@aliyun.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 1, "@jialinlv"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/ware/Guix.c b/src/recipe/ware/Guix.c index f5f2f60..2c74c13 100644 --- a/src/recipe/ware/Guix.c +++ b/src/recipe/ware/Guix.c @@ -14,9 +14,8 @@ wr_guix_prelude () chef_set_last_updated (this, "2025-08-09"); chef_set_sources_last_updated (this, "2025-07-13"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/ware/Homebrew/Homebrew.c b/src/recipe/ware/Homebrew/Homebrew.c index fedb71d..f033a73 100644 --- a/src/recipe/ware/Homebrew/Homebrew.c +++ b/src/recipe/ware/Homebrew/Homebrew.c @@ -16,11 +16,9 @@ wr_homebrew_prelude () chef_set_last_updated (this, "2025-08-09"); chef_set_sources_last_updated (this, "2025-07-13"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Word2VecT", "tangzinan@bupt.edu.cn"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 1, "@Word2VecT"; chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/ware/Nix.c b/src/recipe/ware/Nix.c index 83d1dad..8504716 100644 --- a/src/recipe/ware/Nix.c +++ b/src/recipe/ware/Nix.c @@ -14,9 +14,8 @@ wr_nix_prelude () chef_set_last_updated (this, "2025-08-09"); chef_set_sources_last_updated (this, "2025-07-13"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/ware/TeX-Live.c b/src/recipe/ware/TeX-Live.c index 800fe39..9de3455 100644 --- a/src/recipe/ware/TeX-Live.c +++ b/src/recipe/ware/TeX-Live.c @@ -16,11 +16,9 @@ wr_tex_prelude () chef_set_last_updated (this, "2025-08-09"); chef_set_sources_last_updated (this, "2025-07-28"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Mikachu2333", "mikachu.23333@zohomail.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 1, "@Mikachu2333"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/ware/WinGet.c b/src/recipe/ware/WinGet.c index 4867950..70384f8 100644 --- a/src/recipe/ware/WinGet.c +++ b/src/recipe/ware/WinGet.c @@ -14,10 +14,9 @@ wr_winget_prelude () chef_set_last_updated (this, "2025-08-17"); chef_set_sources_last_updated (this, "2025-07-13"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, "Mikachu2333", "mikachu.23333@zohomail.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 1, "@Mikachu2333"); chef_forbid_english(this); chef_allow_user_define(this); From 7d7e6e17024815a07a6fd6e32f6dda40b2704d62 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 18:03:46 +0800 Subject: [PATCH 066/103] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20pl=20=E7=9A=84=20`?= =?UTF-8?q?chef=5Fset=5Fcooks()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/recipe/lang/Clojure.c | 5 ++--- src/recipe/lang/Dart/Flutter.c | 9 +++------ src/recipe/lang/Dart/Pub.c | 9 +++------ src/recipe/lang/Go.c | 7 ++----- src/recipe/lang/Haskell.c | 5 ++--- src/recipe/lang/Java.c | 8 +++----- src/recipe/lang/JavaScript/Bun.c | 8 +++----- src/recipe/lang/JavaScript/Yarn.c | 8 +++----- src/recipe/lang/JavaScript/common.h | 7 +++---- src/recipe/lang/JavaScript/npm.c | 8 +++----- src/recipe/lang/JavaScript/nvm.c | 5 ++--- src/recipe/lang/JavaScript/pnpm.c | 5 ++--- src/recipe/lang/Julia.c | 5 ++--- src/recipe/lang/Lua.c | 5 ++--- src/recipe/lang/NuGet.c | 3 +-- src/recipe/lang/OCaml.c | 5 ++--- src/recipe/lang/PHP.c | 5 ++--- src/recipe/lang/Perl.c | 5 ++--- src/recipe/lang/Python/PDM.c | 5 ++--- src/recipe/lang/Python/Poetry.c | 5 ++--- src/recipe/lang/Python/Rye.c | 5 ++--- src/recipe/lang/Python/common.h | 7 ++----- src/recipe/lang/Python/pip.c | 5 ++--- src/recipe/lang/Python/uv.c | 9 +++------ src/recipe/lang/R.c | 5 ++--- src/recipe/lang/Ruby/Ruby.c | 5 ++--- src/recipe/lang/Rust/Cargo.c | 9 +++------ src/recipe/lang/Rust/rustup.c | 9 +++------ src/recipe/os/APT/Armbian.c | 9 +++------ src/recipe/os/YUM/Fedora-Linux.c | 7 ++----- src/recipe/os/pacman/Arch-Linux.c | 6 ++---- 31 files changed, 72 insertions(+), 126 deletions(-) diff --git a/src/recipe/lang/Clojure.c b/src/recipe/lang/Clojure.c index d8ddfc1..2e776e7 100644 --- a/src/recipe/lang/Clojure.c +++ b/src/recipe/lang/Clojure.c @@ -14,9 +14,8 @@ pl_clojure_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-07-14"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, FullyCan, NULL, NULL); diff --git a/src/recipe/lang/Dart/Flutter.c b/src/recipe/lang/Dart/Flutter.c index cd9cafe..241673b 100644 --- a/src/recipe/lang/Dart/Flutter.c +++ b/src/recipe/lang/Dart/Flutter.c @@ -14,12 +14,9 @@ pl_dart_flutter_prelude (void) chef_set_last_updated (this, "2025-07-11"); chef_set_sources_last_updated (this, "2025-04-15"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 2, - "czyt", "czyt.go@gmail.com", - "MadDogOwner", "xiaoran@xrgzs.top"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 2, "@czyt", "@MadDogOwner"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/Dart/Pub.c b/src/recipe/lang/Dart/Pub.c index d462325..558c898 100644 --- a/src/recipe/lang/Dart/Pub.c +++ b/src/recipe/lang/Dart/Pub.c @@ -14,12 +14,9 @@ pl_dart_prelude (void) chef_set_last_updated (this, "2025-07-11"); chef_set_sources_last_updated (this, "2025-04-15"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 2, - "czyt", "czyt.go@gmail.com", - "MadDogOwner", "xiaoran@xrgzs.top"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 2, "@czyt", "@MadDogOwner"); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/Go.c b/src/recipe/lang/Go.c index 72f6cf3..1019ff7 100644 --- a/src/recipe/lang/Go.c +++ b/src/recipe/lang/Go.c @@ -28,12 +28,9 @@ pl_go_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-07-12"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 2, - "czyt", "czyt.go@gmail.com", - "Rui Yang", "techoc@foxmail.com"); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 2, "@czyt", "@RuiYang"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/lang/Haskell.c b/src/recipe/lang/Haskell.c index ccd95cd..4e8f901 100644 --- a/src/recipe/lang/Haskell.c +++ b/src/recipe/lang/Haskell.c @@ -14,9 +14,8 @@ pl_haskell_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2023-09-10"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/lang/Java.c b/src/recipe/lang/Java.c index c9b1161..f00a9fb 100644 --- a/src/recipe/lang/Java.c +++ b/src/recipe/lang/Java.c @@ -14,11 +14,9 @@ pl_java_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-12-18"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "BingChunMoLi", "bingchunmoli@bingchunmoli.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 1, "@BingChunMoLi"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/lang/JavaScript/Bun.c b/src/recipe/lang/JavaScript/Bun.c index ae7108a..498c6f3 100644 --- a/src/recipe/lang/JavaScript/Bun.c +++ b/src/recipe/lang/JavaScript/Bun.c @@ -14,11 +14,9 @@ pl_js_bun_prelude (void) chef_set_last_updated (this, "2025-07-22"); chef_set_sources_last_updated (this, "2025-07-22"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Lontten", "lontten@163.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 1, "@Lontten"); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/JavaScript/Yarn.c b/src/recipe/lang/JavaScript/Yarn.c index 1d2ff97..f686103 100644 --- a/src/recipe/lang/JavaScript/Yarn.c +++ b/src/recipe/lang/JavaScript/Yarn.c @@ -14,11 +14,9 @@ pl_js_yarn_prelude (void) chef_set_last_updated (this, "2025-07-11"); chef_set_sources_last_updated (this, "2025-07-11"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Mr. Will", "mr.will.com@outlook.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 1, "@MrWill"); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/JavaScript/common.h b/src/recipe/lang/JavaScript/common.h index 6968249..830d51f 100644 --- a/src/recipe/lang/JavaScript/common.h +++ b/src/recipe/lang/JavaScript/common.h @@ -21,7 +21,7 @@ pl_js_group_prelude (void) chef_set_last_updated (this, "2025-07-11"); chef_set_sources_last_updated (this, "2025-07-11"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_chef (this, "@happy-game"); @@ -58,9 +58,8 @@ pl_js_nodejs_binary_prelude (void) chef_set_last_updated (this, "2025-07-11"); chef_set_sources_last_updated (this, "2025-07-11"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/lang/JavaScript/npm.c b/src/recipe/lang/JavaScript/npm.c index a4a4976..2c9b99b 100644 --- a/src/recipe/lang/JavaScript/npm.c +++ b/src/recipe/lang/JavaScript/npm.c @@ -14,11 +14,9 @@ pl_js_npm_prelude (void) chef_set_last_updated (this, "2025-07-11"); chef_set_sources_last_updated (this, "2025-07-11"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Mr. Will", "mr.will.com@outlook.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 1, "@MrWill"); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/JavaScript/nvm.c b/src/recipe/lang/JavaScript/nvm.c index 02a0954..9586f38 100644 --- a/src/recipe/lang/JavaScript/nvm.c +++ b/src/recipe/lang/JavaScript/nvm.c @@ -14,9 +14,8 @@ pl_js_nvm_prelude (void) chef_set_last_updated (this, "2025-06-19"); chef_set_sources_last_updated (this, "2025-06-19"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/lang/JavaScript/pnpm.c b/src/recipe/lang/JavaScript/pnpm.c index 895052e..bba23aa 100644 --- a/src/recipe/lang/JavaScript/pnpm.c +++ b/src/recipe/lang/JavaScript/pnpm.c @@ -14,9 +14,8 @@ pl_js_pnpm_prelude (void) chef_set_last_updated (this, "2025-07-11"); chef_set_sources_last_updated (this, "2025-07-11"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, FullyCan, NULL, NULL); diff --git a/src/recipe/lang/Julia.c b/src/recipe/lang/Julia.c index f709632..2e6374b 100644 --- a/src/recipe/lang/Julia.c +++ b/src/recipe/lang/Julia.c @@ -14,9 +14,8 @@ pl_julia_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-07-14"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/lang/Lua.c b/src/recipe/lang/Lua.c index ab18a33..e116e76 100644 --- a/src/recipe/lang/Lua.c +++ b/src/recipe/lang/Lua.c @@ -21,9 +21,8 @@ pl_lua_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-07-14"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/lang/NuGet.c b/src/recipe/lang/NuGet.c index ec54878..f1d438d 100644 --- a/src/recipe/lang/NuGet.c +++ b/src/recipe/lang/NuGet.c @@ -14,9 +14,8 @@ pl_nuget_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-04-18"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/lang/OCaml.c b/src/recipe/lang/OCaml.c index b41edfa..f57344c 100644 --- a/src/recipe/lang/OCaml.c +++ b/src/recipe/lang/OCaml.c @@ -14,9 +14,8 @@ pl_ocaml_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-07-14"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/lang/PHP.c b/src/recipe/lang/PHP.c index d69d05f..1805362 100644 --- a/src/recipe/lang/PHP.c +++ b/src/recipe/lang/PHP.c @@ -14,9 +14,8 @@ pl_php_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-09-14"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, FullyCan, NULL, NULL); diff --git a/src/recipe/lang/Perl.c b/src/recipe/lang/Perl.c index 16f61ec..e2d5d72 100644 --- a/src/recipe/lang/Perl.c +++ b/src/recipe/lang/Perl.c @@ -14,9 +14,8 @@ pl_perl_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-05-24"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); // TODO: 添加 @hezonglun diff --git a/src/recipe/lang/Python/PDM.c b/src/recipe/lang/Python/PDM.c index fb3d196..bc35f74 100644 --- a/src/recipe/lang/Python/PDM.c +++ b/src/recipe/lang/Python/PDM.c @@ -14,9 +14,8 @@ pl_python_pdm_prelude (void) chef_set_last_updated (this, "2025-07-11"); chef_set_sources_last_updated (this, "2025-07-11"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, FullyCan, "支持项目级配置", "Supports project-level configuration"); diff --git a/src/recipe/lang/Python/Poetry.c b/src/recipe/lang/Python/Poetry.c index 10065cc..b9c4412 100644 --- a/src/recipe/lang/Python/Poetry.c +++ b/src/recipe/lang/Python/Poetry.c @@ -14,9 +14,8 @@ pl_python_poetry_prelude (void) chef_set_last_updated (this, "2025-07-11"); chef_set_sources_last_updated (this, "2025-07-11"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, FullyCan, "Poetry 默认使用项目级换源", "Poetry uses project-level source changing by default"); diff --git a/src/recipe/lang/Python/Rye.c b/src/recipe/lang/Python/Rye.c index 3623ac7..9bc258a 100644 --- a/src/recipe/lang/Python/Rye.c +++ b/src/recipe/lang/Python/Rye.c @@ -16,9 +16,8 @@ pl_python_rye_prelude (void) chef_set_last_updated (this, "2025-08-09"); chef_set_sources_last_updated (this, "2025-08-09"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, FullyCan, "支持项目级配置", "Supports project-level configuration"); diff --git a/src/recipe/lang/Python/common.h b/src/recipe/lang/Python/common.h index e207304..cf55ff4 100644 --- a/src/recipe/lang/Python/common.h +++ b/src/recipe/lang/Python/common.h @@ -29,12 +29,9 @@ pl_python_group_prelude (void) chef_set_last_updated (this, "2025-07-14"); chef_set_sources_last_updated (this, "2025-07-11"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, "@happy-game"); - chef_set_contributors (this, 1, - "yongxiang", "1926885268@qq.com"); - + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 1, "@yongxiang"); chef_allow_local_mode (this, PartiallyCan, "部分包管理器支持项目级换源", "Some package managers support project-level source changing"); chef_allow_english(this); diff --git a/src/recipe/lang/Python/pip.c b/src/recipe/lang/Python/pip.c index 08f3ca0..bda3465 100644 --- a/src/recipe/lang/Python/pip.c +++ b/src/recipe/lang/Python/pip.c @@ -14,9 +14,8 @@ pl_python_pip_prelude (void) chef_set_last_updated (this, "2025-07-11"); chef_set_sources_last_updated (this, "2025-07-11"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/lang/Python/uv.c b/src/recipe/lang/Python/uv.c index 2a47c0c..9f2c64b 100644 --- a/src/recipe/lang/Python/uv.c +++ b/src/recipe/lang/Python/uv.c @@ -14,12 +14,9 @@ pl_python_uv_prelude (void) chef_set_last_updated (this, "2025-08-09"); chef_set_sources_last_updated (this, "2025-08-09"); - chef_set_authors (this, 1, "happy game", "happygame1024@gmail.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 2, - "ccy", "icuichengyi@gmail.com", - "Aoran Zeng", "ccmywish@qq.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@happy-game"); + chef_set_contributors (this, 2, "@ccy", "@Aoran Zeng"); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/R.c b/src/recipe/lang/R.c index 7bbf3ed..e60648f 100644 --- a/src/recipe/lang/R.c +++ b/src/recipe/lang/R.c @@ -14,9 +14,8 @@ pl_r_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2023-09-04"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/lang/Ruby/Ruby.c b/src/recipe/lang/Ruby/Ruby.c index 4542ef4..aa6033a 100644 --- a/src/recipe/lang/Ruby/Ruby.c +++ b/src/recipe/lang/Ruby/Ruby.c @@ -21,9 +21,8 @@ pl_ruby_prelude (void) chef_set_last_updated (this, "2025-08-11"); chef_set_sources_last_updated (this, "2024-12-18"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_cooks (this, 0); + chef_set_chef (this, "@ccmywish"); + chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); chef_allow_local_mode (this, PartiallyCan, "支持 bundler. 不支持 gem", "Support bundler. Not support gem"); diff --git a/src/recipe/lang/Rust/Cargo.c b/src/recipe/lang/Rust/Cargo.c index eaf743e..3a074a4 100644 --- a/src/recipe/lang/Rust/Cargo.c +++ b/src/recipe/lang/Rust/Cargo.c @@ -14,12 +14,9 @@ pl_rust_cargo_prelude (void) chef_set_last_updated (this, "2025-07-22"); chef_set_sources_last_updated (this, "2025-06-18"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 1, - "Mikachu2333", "mikachu.23333@zohomail.com"); - + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 1, "@Mikachu2333"); chef_allow_local_mode (this, PartiallyCan, "可以基于本项目换源吗?请帮助确认", "Can it change sources based on this project? Please help confirm"); chef_forbid_english (this); diff --git a/src/recipe/lang/Rust/rustup.c b/src/recipe/lang/Rust/rustup.c index cba0bf4..a81a75b 100644 --- a/src/recipe/lang/Rust/rustup.c +++ b/src/recipe/lang/Rust/rustup.c @@ -17,12 +17,9 @@ pl_rust_rustup_prelude (void) chef_set_last_updated (this, "2025-08-07"); chef_set_sources_last_updated (this, "2025-08-07"); - chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 2, - "Yangmoooo", "yangmoooo@outlook.com", - "Mikachu2333", "mikachu.23333@zohomail.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_contributors (this, 2, "@Yangmoooo", "@Mikachu2333"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english (this); diff --git a/src/recipe/os/APT/Armbian.c b/src/recipe/os/APT/Armbian.c index b87595f..f864de6 100644 --- a/src/recipe/os/APT/Armbian.c +++ b/src/recipe/os/APT/Armbian.c @@ -14,12 +14,9 @@ os_armbian_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-11-21"); - chef_set_authors (this, 1, "Shengwei Chen", "414685209@qq.com"); - chef_set_chef (this, NULL, NULL); - chef_set_cooks (this, 0); - chef_set_contributors (this, 2, - "Aoran Zeng", "ccmywish@qq.com", - "Yangmoooo", "yangmoooo@outlook.com"); + chef_set_chef (this, NULL); + chef_set_cooks (this, 1, "@lovely"); + chef_set_contributors (this, 2, "@ccmywish", "@yangmoooo"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/YUM/Fedora-Linux.c b/src/recipe/os/YUM/Fedora-Linux.c index 88a374b..999b0df 100644 --- a/src/recipe/os/YUM/Fedora-Linux.c +++ b/src/recipe/os/YUM/Fedora-Linux.c @@ -14,12 +14,9 @@ os_fedora_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-06-20"); - chef_set_authors (this, 2, - "Heng Guo", "2085471348@qq.com", - "happy game", "happygame1024@gmail.com"); chef_set_chef (this, "@happy-game"); - chef_set_contributors (this, 1, - "Aoran Zeng", "ccmywish@qq.com"); + chef_set_cooks (this, 2, "@G_I_Y", "@happy-game"); + chef_set_contributors (this, 1, "@ccmywish"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/pacman/Arch-Linux.c b/src/recipe/os/pacman/Arch-Linux.c index 0faff53..5d4a791 100644 --- a/src/recipe/os/pacman/Arch-Linux.c +++ b/src/recipe/os/pacman/Arch-Linux.c @@ -17,11 +17,9 @@ os_arch_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-06-20"); - chef_set_authors (this, 2, "Aoran Zeng", "ccmywish@qq.com", - "Heng Guo", "2085471348@qq.com"); chef_set_chef (this, "@happy-game"); - chef_set_contributors (this, 1, - "happy game", "happygame1024@gmail.com"); + chef_set_cooks (this, 2, "@ccmywish", "@G_I_Y"); + chef_set_contributors (this, 1, "@happy-game"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); From 2156dbacad925727c6ed918e04e120df4304c1ed Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 18:12:37 +0800 Subject: [PATCH 067/103] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chsrc-main.c | 27 ++++++--------------------- src/framework/chef.c | 2 +- src/recipe/lang/Go.c | 2 +- src/recipe/lang/NuGet.c | 2 +- src/recipe/os/APT/Linux-Lite.c | 2 +- src/recipe/ware/Homebrew/Homebrew.c | 2 +- 6 files changed, 11 insertions(+), 26 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 328aa50..bee138b 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -333,27 +333,12 @@ cli_print_target_features (Target_t *target, const char *input_target_name) void cli_print_target_maintain_info (Target_t *target, const char *input_target_name) { - if (target->authors && target->authors_n > 0) - { - char *msg = ENGLISH ? "Recipe Original Authors: " : "食谱原始作者: "; - printf ("%s", bdblue(msg)); - for (size_t i = 0; i < target->authors_n; i++) - { - if (i > 0) printf (", "); - printf ("%s <%s>", - target->authors[i].name ? target->authors[i].name : "Unknown", - target->authors[i].email ? target->authors[i].email : "unknown@example.com"); - } - printf ("\n"); - } - if (target->created_on) { - char *msg = ENGLISH ? "Recipe Created On: " : "食谱创建时间: "; + char *msg = ENGLISH ? "Recipe Created On: " : "食谱诞生时间: "; printf ("%s%s\n", bdblue(msg), target->created_on); } - { char *msg = ENGLISH ? "Current Chef: " : "当前主厨: "; if (target->chef) @@ -371,7 +356,7 @@ cli_print_target_maintain_info (Target_t *target, const char *input_target_name) { - char *msg = ENGLISH ? "Current Cooks: " : "当前副厨: "; + char *msg = ENGLISH ? "Current Cooks: " : "主要厨师: "; if (target->cooks && target->cooks_n > 0) { printf ("%s", bdblue(msg)); @@ -379,8 +364,8 @@ cli_print_target_maintain_info (Target_t *target, const char *input_target_name) { if (i > 0) printf (", "); printf ("%s <%s>", - target->cooks[i].name ? target->cooks[i].name : "Unknown", - target->cooks[i].email ? target->cooks[i].email : "unknown@example.com"); + target->cooks[i]->name ? target->cooks[i]->name : "Unknown", + target->cooks[i]->email ? target->cooks[i]->email : "unknown@example.com"); } printf ("\n"); } @@ -400,8 +385,8 @@ cli_print_target_maintain_info (Target_t *target, const char *input_target_name) { if (i > 0) printf (", "); printf ("%s <%s>", - target->contributors[i].name ? target->contributors[i].name : "Unknown", - target->contributors[i].email ? target->contributors[i].email : "unknown@example.com"); + target->contributors[i]->name ? target->contributors[i]->name : "Unknown", + target->contributors[i]->email ? target->contributors[i]->email : "unknown@example.com"); } printf ("\n"); } diff --git a/src/framework/chef.c b/src/framework/chef.c index 2f4c89d..0c2c0b8 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -191,7 +191,7 @@ chef_verify_contributor (const char *id) if (!c) { char error[256]; - snprintf (error, sizeof (error), "贡献者不存在: %s", id); + snprintf (error, sizeof (error), "贡献者不存在: %s, 是否写错?或者请在 chsrc-main.c 中登记该贡献者", id); chsrc_panic (error); } return c; diff --git a/src/recipe/lang/Go.c b/src/recipe/lang/Go.c index 1019ff7..d717052 100644 --- a/src/recipe/lang/Go.c +++ b/src/recipe/lang/Go.c @@ -28,7 +28,7 @@ pl_go_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2025-07-12"); - chef_set_chef (this, NULL, NULL); + chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 2, "@czyt", "@RuiYang"); diff --git a/src/recipe/lang/NuGet.c b/src/recipe/lang/NuGet.c index f1d438d..68b574c 100644 --- a/src/recipe/lang/NuGet.c +++ b/src/recipe/lang/NuGet.c @@ -14,7 +14,7 @@ pl_nuget_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-04-18"); - chef_set_chef (this, NULL, NULL); + chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 0); diff --git a/src/recipe/os/APT/Linux-Lite.c b/src/recipe/os/APT/Linux-Lite.c index 44aa657..857cfa8 100644 --- a/src/recipe/os/APT/Linux-Lite.c +++ b/src/recipe/os/APT/Linux-Lite.c @@ -14,7 +14,7 @@ os_linuxlite_prelude () chef_set_last_updated (this, "2025-08-10"); chef_set_sources_last_updated (this, "2024-11-21"); - chef_set_chef (this, NULL, NULL); + chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); chef_set_contributors (this, 1, "@Yangmoooo"); diff --git a/src/recipe/ware/Homebrew/Homebrew.c b/src/recipe/ware/Homebrew/Homebrew.c index f033a73..9e206ad 100644 --- a/src/recipe/ware/Homebrew/Homebrew.c +++ b/src/recipe/ware/Homebrew/Homebrew.c @@ -18,7 +18,7 @@ wr_homebrew_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@Word2VecT"; + chef_set_contributors (this, 1, "@Word2VecT"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); From 46083f03ec5b6cc471b20485ee61b0c0be485d40 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 18:28:33 +0800 Subject: [PATCH 068/103] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20`chef=5Fdebug=5Fco?= =?UTF-8?q?ntributor()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chsrc-main.c | 4 ++-- src/framework/chef.c | 25 +++++++++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index bee138b..fd5724b 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -529,6 +529,8 @@ typedef enum { bool get_target (const char *input, TargetOp code, char *option) { + chsrc_register_contributors (); + Target_t *target = NULL; bool matched = iterate_menu (chsrc_pl_menu, input, &target); @@ -537,8 +539,6 @@ get_target (const char *input, TargetOp code, char *option) if (!matched) return false; - chsrc_register_contributors (); - if (TargetOp_Set_Source==code) { if (target->setfn) diff --git a/src/framework/chef.c b/src/framework/chef.c index 0c2c0b8..4e10ad3 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -305,19 +305,17 @@ chef_debug_target (Target_t *target) #ifdef XY_DEBUG if (!target) { - chsrc_debug2 ("t", "Target is NULL"); + chsrc_debug2 ("target", "Target is NULL"); return; } - say ("Debug Target Information:"); + say ("DEBUG Target Information:"); printf (" Get Function: %p\n", target->getfn); printf (" Set Function: %p\n", target->setfn); printf (" Reset Function: %p\n", target->resetfn); printf (" Sources: %p\n", target->sources); printf (" Sources Count: %lld\n", target->sources_n); - printf (" Authors: %p\n", target->authors); - printf (" Authors Count: %lld\n", target->authors_n); printf (" Chef: %p\n", target->chef); printf (" Cooks: %p\n", target->cooks); printf (" Cooks Count: %lld\n", target->cooks_n); @@ -325,3 +323,22 @@ chef_debug_target (Target_t *target) printf (" Contributors Count: %lld\n", target->contributors_n); #endif } + + +void +chef_debug_contributor (Contributor_t *contributor) +{ +#ifdef XY_DEBUG + if (!contributor) + { + chsrc_debug2 ("contrib", "Contributor is NULL"); + return; + } + + say ("DEBUG Contributor Information:"); + printf (" ID: %s\n", contributor->id); + printf (" Name: %s\n", contributor->name); + printf (" Email: %s\n", contributor->email); + printf (" DisplayName: %s\n", contributor->display_name); +#endif +} From 4e9ea3ccc235178b416325285faf4afb0e864e1f Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 18:40:08 +0800 Subject: [PATCH 069/103] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9F=90=E4=BD=8D?= =?UTF-8?q?=E8=B4=A1=E7=8C=AE=E8=80=85=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/recipe/lang/Python/common.h | 2 +- src/recipe/ware/Anaconda/Anaconda.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/recipe/lang/Python/common.h b/src/recipe/lang/Python/common.h index cf55ff4..bdb2641 100644 --- a/src/recipe/lang/Python/common.h +++ b/src/recipe/lang/Python/common.h @@ -31,7 +31,7 @@ pl_python_group_prelude (void) chef_set_chef (this, "@happy-game"); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@yongxiang"); + chef_set_contributors (this, 1, "@xyx1926885268"); chef_allow_local_mode (this, PartiallyCan, "部分包管理器支持项目级换源", "Some package managers support project-level source changing"); chef_allow_english(this); diff --git a/src/recipe/ware/Anaconda/Anaconda.c b/src/recipe/ware/Anaconda/Anaconda.c index 49cee41..baca25d 100644 --- a/src/recipe/ware/Anaconda/Anaconda.c +++ b/src/recipe/ware/Anaconda/Anaconda.c @@ -18,7 +18,7 @@ wr_anaconda_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 2, "@Yangmoooo", "@yongxiang"); + chef_set_contributors (this, 2, "@Yangmoooo", "@xyx1926885268"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); From 2f46cd63f5b8b4683f4e73a560230575e6f6bf37 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 18:41:15 +0800 Subject: [PATCH 070/103] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BB=B4=E6=8A=A4?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=98=BE=E7=A4=BA=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chsrc-main.c | 4 ++-- src/framework/chef.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index fd5724b..65e6f21 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -335,7 +335,7 @@ cli_print_target_maintain_info (Target_t *target, const char *input_target_name) { if (target->created_on) { - char *msg = ENGLISH ? "Recipe Created On: " : "食谱诞生时间: "; + char *msg = ENGLISH ? "Recipe Created On: " : "食谱创建时间: "; printf ("%s%s\n", bdblue(msg), target->created_on); } @@ -356,7 +356,7 @@ cli_print_target_maintain_info (Target_t *target, const char *input_target_name) { - char *msg = ENGLISH ? "Current Cooks: " : "主要厨师: "; + char *msg = ENGLISH ? "Cooks: " : "掌勺厨师: "; if (target->cooks && target->cooks_n > 0) { printf ("%s", bdblue(msg)); diff --git a/src/framework/chef.c b/src/framework/chef.c index 4e10ad3..a82b9f8 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -5,7 +5,7 @@ * File Authors : 曾奥然 * Contributors : Nul None * Created On : <2025-08-09> - * Last Modified : <2025-08-20> + * Last Modified : <2025-08-21> * * chef DSL: for chefs (recipe makers) to define a target * ------------------------------------------------------------*/ @@ -191,7 +191,7 @@ chef_verify_contributor (const char *id) if (!c) { char error[256]; - snprintf (error, sizeof (error), "贡献者不存在: %s, 是否写错?或者请在 chsrc-main.c 中登记该贡献者", id); + snprintf (error, sizeof (error), "贡献者 %s 不存在, 是否写错?或请在 chsrc-main.c 中登记该贡献者", id); chsrc_panic (error); } return c; From a08ef58579203d7fce4ec03c059852f385a02d51 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 18:47:33 +0800 Subject: [PATCH 071/103] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=B4=E6=8A=A4?= =?UTF-8?q?=E8=80=85=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/recipe/lang/Clojure.c | 4 ++-- src/recipe/lang/Perl.c | 5 ++--- src/recipe/lang/R.c | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/recipe/lang/Clojure.c b/src/recipe/lang/Clojure.c index 2e776e7..1f52d59 100644 --- a/src/recipe/lang/Clojure.c +++ b/src/recipe/lang/Clojure.c @@ -12,11 +12,11 @@ pl_clojure_prelude () chef_set_created_on (this, "2023-09-10"); chef_set_last_updated (this, "2025-08-10"); - chef_set_sources_last_updated (this, "2025-07-14"); + chef_set_sources_last_updated (this, "2025-08-21"); chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_contributors (this, 1, "@hezonglun"); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/lang/Perl.c b/src/recipe/lang/Perl.c index e2d5d72..c7d6cbd 100644 --- a/src/recipe/lang/Perl.c +++ b/src/recipe/lang/Perl.c @@ -12,12 +12,11 @@ pl_perl_prelude () chef_set_created_on (this, "2023-09-31"); chef_set_last_updated (this, "2025-08-10"); - chef_set_sources_last_updated (this, "2024-05-24"); + chef_set_sources_last_updated (this, "2025-08-21"); chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); - // TODO: 添加 @hezonglun + chef_set_contributors (this, 1, "@hezonglun"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/lang/R.c b/src/recipe/lang/R.c index e60648f..0530a56 100644 --- a/src/recipe/lang/R.c +++ b/src/recipe/lang/R.c @@ -12,11 +12,11 @@ pl_r_prelude () chef_set_created_on (this, "2023-09-21"); chef_set_last_updated (this, "2025-08-10"); - chef_set_sources_last_updated (this, "2023-09-04"); + chef_set_sources_last_updated (this, "2025-08-21"); chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_contributors (this, 1, "@hezonglun"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); From f1eaffab4af152dc87b1072f191a5c6a0f85a15c Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 18:53:25 +0800 Subject: [PATCH 072/103] =?UTF-8?q?=E4=B8=BA=20Chef=20=E5=92=8C=20Cooks=20?= =?UTF-8?q?=E4=BA=BA=E6=95=B0=E8=AE=BE=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/chef.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/framework/chef.c b/src/framework/chef.c index a82b9f8..5352459 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -206,8 +206,14 @@ chef_set_chef (Target_t *target, const char *id) { xy_cant_be_null (target); - Contributor_t *c = chef_verify_contributor (id); + /* Chef 可为空 */ + if (!id) + { + target->chef = NULL; + return; + } + Contributor_t *c = chef_verify_contributor (id); target->chef = c; } @@ -222,8 +228,7 @@ chef_set_cooks (Target_t *target, size_t count, ...) if (count == 0) { - target->cooks = NULL; - target->cooks_n = 0; + chsrc_panic ("recipe 一定至少有1位作者(cooks)"); return; } From d7ca422100327b589c734ac11e4b1a9878c4b283 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 19:22:26 +0800 Subject: [PATCH 073/103] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BB=B4=E6=8A=A4?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=98=BE=E7=A4=BA=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chsrc-main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 65e6f21..68f5dc7 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -340,7 +340,7 @@ cli_print_target_maintain_info (Target_t *target, const char *input_target_name) } { - char *msg = ENGLISH ? "Current Chef: " : "当前主厨: "; + char *msg = ENGLISH ? "Current Chef: " : "品控: "; if (target->chef) { printf ("%s%s <%s>\n", bdblue(msg), @@ -349,14 +349,14 @@ cli_print_target_maintain_info (Target_t *target, const char *input_target_name) } else { - char *msg1 = CHINESE ? "暂空缺, 欢迎担任!" : "Vacant, Welcome to hold the position"; + char *msg1 = CHINESE ? "该 recipe 的负责人暂空缺, 欢迎担任" : "Vacant, Welcome to hold the position"; printf ("%s%s\n", bdblue(msg), bdgreen(msg1)); } } { - char *msg = ENGLISH ? "Cooks: " : "掌勺厨师: "; + char *msg = ENGLISH ? "Cooks: " : "掌勺: "; if (target->cooks && target->cooks_n > 0) { printf ("%s", bdblue(msg)); @@ -371,13 +371,13 @@ cli_print_target_maintain_info (Target_t *target, const char *input_target_name) } else { - char *msg1 = CHINESE ? "暂空缺, 欢迎担任!" : "Vacant, Welcome to hold the position!"; + char *msg1 = CHINESE ? "暂空缺, 欢迎担任" : "Vacant, Welcome to hold the position"; printf ("%s%s\n", bdblue(msg), bdgreen(msg1)); } } { - char *msg = ENGLISH ? "Contributors: " : "贡献者: "; + char *msg = ENGLISH ? "Contributors: " : "调味: "; if (target->contributors && target->contributors_n > 0) { printf ("%s", bdblue(msg)); From 16dff95df0d289c80cc3f9bbe5b981f2b1c3d3ea Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 21 Aug 2025 20:12:05 +0800 Subject: [PATCH 074/103] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B4=A1=E7=8C=AE?= =?UTF-8?q?=E8=80=85id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chsrc-main.c | 15 +++++++++++++-- src/recipe/lang/Dart/Flutter.c | 2 +- src/recipe/lang/Dart/Pub.c | 2 +- src/recipe/lang/Go.c | 2 +- src/recipe/lang/JavaScript/Bun.c | 2 +- src/recipe/lang/JavaScript/Yarn.c | 2 +- src/recipe/lang/JavaScript/npm.c | 2 +- src/recipe/lang/Python/uv.c | 2 +- src/recipe/os/APT/Armbian.c | 4 ++-- src/recipe/os/APT/Ubuntu.c | 2 +- src/recipe/ware/Flatpak.c | 2 +- 11 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 68f5dc7..559a4b1 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -51,7 +51,9 @@ chsrc_register_contributors () { /* 项目创建者 */ chef_register_contributor ("@ccmywish", "曾奥然", "ccmywish@qq.com", NULL); + // 该 ID 为 Gitee ID chef_register_contributor ("@G_I_Y", "郭恒", "2085471348@qq.com", NULL); + /* 所有贡献者 (按参与贡献时间排序) */ chef_register_contributor ("@Aaron-212", "Aaron Ruan", "aaron212cn@outlook.com", NULL); chef_register_contributor ("@chenrui333", "Rui Chen", "rui@chenrui.dev", NULL); @@ -65,21 +67,30 @@ chsrc_register_contributors () chef_register_contributor ("@Word2VecT", "Word2VecT", "tangzinan@bupt.edu.cn", NULL); chef_register_contributor ("@wickdynex", "Xuan", "wick.dynex@qq.com", NULL); chef_register_contributor ("@Efterklang", "GnixAij", "gaojiaxing0220@gmail.com", NULL); - chef_register_contributor ("@ChatGPT", "ChatGPT", "chatgpt.com", NULL); chef_register_contributor ("@czyt", "czyt", "czyt.go@gmail.com", NULL); + chef_register_contributor ("@XUANJI233", "XUANJI233", "xuanji233@outlook.com", NULL); + chef_register_contributor ("@Yangmoooo", "Yangmoooo", "yangmoooo@outlook.com", NULL); chef_register_contributor ("@zouri", "Zouri", "guoshuaisun@outlook.com", NULL); chef_register_contributor ("@xyx1926885268", "Yongxiang", "1926885268@qq.com", NULL); chef_register_contributor ("@YU-7", "YU-7", "2747046473@qq.com", NULL); chef_register_contributor ("@juzeon", "juzeon", "skyjuzheng@gmail.com", NULL); chef_register_contributor ("@jialinlvcn", "Jialin Lyu", "jialinlvcn@aliyun.com", NULL); - chef_register_contributor ("@GitHub Copilot", "GitHub Copilot", "github.com/copilot", NULL); chef_register_contributor ("@Kattos", "ccy", "icuichengyi@gmail.com", NULL); chef_register_contributor ("@xrgzs", "MadDogOwner", "xiaoran@xrgzs.top", NULL); chef_register_contributor ("@sanchuanhehe", "sanchuanhehe", "wyihe5520@gmail.com", NULL); chef_register_contributor ("@Mikachu2333", "Mikachu2333", "mikachu.23333@zohomail.com", NULL); chef_register_contributor ("@techoc", "Rui Yang", "techoc@foxmail.com", NULL); chef_register_contributor ("@BingChunMoLi", "BingChunMoLi", "bingchunmoli@bingchunmoli.com", NULL); + // 该 ID 为 Gitee ID chef_register_contributor ("@hezonglun", "HeZongLun", "hezonglun123456@outlook.com", NULL); + + /** + * AI贡献者: + * + * ChatGPT、GitHub Copilot、DeepSeek + * + * 这几位是贡献者显式说明的,也许还有隐式使用的一些AI并没有被记录下来,可以添加在这里 + */ } #include "recipe/menu.c" diff --git a/src/recipe/lang/Dart/Flutter.c b/src/recipe/lang/Dart/Flutter.c index 241673b..ae04192 100644 --- a/src/recipe/lang/Dart/Flutter.c +++ b/src/recipe/lang/Dart/Flutter.c @@ -16,7 +16,7 @@ pl_dart_flutter_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 2, "@czyt", "@MadDogOwner"); + chef_set_contributors (this, 2, "@czyt", "@xrgzs"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/Dart/Pub.c b/src/recipe/lang/Dart/Pub.c index 558c898..fa3990f 100644 --- a/src/recipe/lang/Dart/Pub.c +++ b/src/recipe/lang/Dart/Pub.c @@ -16,7 +16,7 @@ pl_dart_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 2, "@czyt", "@MadDogOwner"); + chef_set_contributors (this, 2, "@czyt", "@xrgzs"); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/Go.c b/src/recipe/lang/Go.c index d717052..f1b9ae4 100644 --- a/src/recipe/lang/Go.c +++ b/src/recipe/lang/Go.c @@ -30,7 +30,7 @@ pl_go_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 2, "@czyt", "@RuiYang"); + chef_set_contributors (this, 2, "@czyt", "@techoc"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/lang/JavaScript/Bun.c b/src/recipe/lang/JavaScript/Bun.c index 498c6f3..394c22f 100644 --- a/src/recipe/lang/JavaScript/Bun.c +++ b/src/recipe/lang/JavaScript/Bun.c @@ -16,7 +16,7 @@ pl_js_bun_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@Lontten"); + chef_set_contributors (this, 1, "@lontten"); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/JavaScript/Yarn.c b/src/recipe/lang/JavaScript/Yarn.c index f686103..8c4c1a2 100644 --- a/src/recipe/lang/JavaScript/Yarn.c +++ b/src/recipe/lang/JavaScript/Yarn.c @@ -16,7 +16,7 @@ pl_js_yarn_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@MrWill"); + chef_set_contributors (this, 1, "@MrWillCom"); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/JavaScript/npm.c b/src/recipe/lang/JavaScript/npm.c index 2c9b99b..93d5b8e 100644 --- a/src/recipe/lang/JavaScript/npm.c +++ b/src/recipe/lang/JavaScript/npm.c @@ -16,7 +16,7 @@ pl_js_npm_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@MrWill"); + chef_set_contributors (this, 1, "@MrWillCom"); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/Python/uv.c b/src/recipe/lang/Python/uv.c index 9f2c64b..e81fb3b 100644 --- a/src/recipe/lang/Python/uv.c +++ b/src/recipe/lang/Python/uv.c @@ -16,7 +16,7 @@ pl_python_uv_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@happy-game"); - chef_set_contributors (this, 2, "@ccy", "@Aoran Zeng"); + chef_set_contributors (this, 2, "@Kattos", "@ccmywish"); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/os/APT/Armbian.c b/src/recipe/os/APT/Armbian.c index f864de6..f0728e8 100644 --- a/src/recipe/os/APT/Armbian.c +++ b/src/recipe/os/APT/Armbian.c @@ -15,8 +15,8 @@ os_armbian_prelude () chef_set_sources_last_updated (this, "2024-11-21"); chef_set_chef (this, NULL); - chef_set_cooks (this, 1, "@lovely"); - chef_set_contributors (this, 2, "@ccmywish", "@yangmoooo"); + chef_set_cooks (this, 1, "@livelycode36"); + chef_set_contributors (this, 2, "@ccmywish", "@Yangmoooo"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/Ubuntu.c b/src/recipe/os/APT/Ubuntu.c index 2454b0c..8895d6f 100644 --- a/src/recipe/os/APT/Ubuntu.c +++ b/src/recipe/os/APT/Ubuntu.c @@ -17,7 +17,7 @@ os_ubuntu_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 2, "@ccmywish", "@G_I_Y"); - chef_set_contributors (this, 1, "@Zhao"); + chef_set_contributors (this, 1, "@XUANJI233"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/ware/Flatpak.c b/src/recipe/ware/Flatpak.c index 56de2d0..572c523 100644 --- a/src/recipe/ware/Flatpak.c +++ b/src/recipe/ware/Flatpak.c @@ -16,7 +16,7 @@ wr_flatpak_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@jialinlv"); + chef_set_contributors (this, 1, "@jialinlvcn"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); From 4d70428e35c390d41f5ea82a49d58265ef3491e8 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 09:39:50 +0800 Subject: [PATCH 075/103] =?UTF-8?q?`ls`=20=E6=97=B6=E5=A4=87=E6=B3=A8?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=A2=9E=E5=8A=A0=E7=A9=BA=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chsrc-main.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 559a4b1..e0dcff6 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -13,24 +13,16 @@ * ------------------------------------------------------------- * * 这是一个高度依靠贡献者的项目,我们直接把每一位贡献者写进了代码 - * 里,这是比 Git commit 更加稳定的方式。但我们不满足于把大家写在 - * 注释里,因为C语言在编译时会无情地把这些信息抹去。 + * 里,这是比 Git commit message 更加稳定的方式。但我们不满足于仅 + * 把大家写在注释里,因为C语言在编译时会无情地把这些信息抹去。 * * 所以,我们让每一位贡献者直接参与运行时! * - * 想象一下,每一位贡献者都化作一串比特: - * 栖居在内蒙古与贵州的数据中心中; - * 穿梭于北京与上海的机房; - * 流淌在广东、浙江的云里; - * 散布于四川与重庆的算力集群; - * 潜藏在陕西、甘肃、宁夏的机架之间; - * 分身于全国各地的桌面电脑里,点亮在湖北、山东、河南的家庭宽带 - * 上,跃动在江苏、安徽、湖南的手机与路由器中,乃至潜入那些无名的 - * 小型嵌入式设备。 - * + * 想象一下,每一位贡献者都化作一串比特,穿梭于全国各地的桌面PC中, + * 流淌在数据中心的机房,分身在手机、路由器、小型嵌入式设备中... * 每当 chsrc 执行一次 recipe 相关的操作,这些比特便会复苏,贡献者 * 的信息随之浮现。它提醒着使用者:在你与开源世界的每一次交互背后, - * 都是无数人的心血,跨越省份与疆域,以代码相连,持续回响。 + * 都是许多人的协作,跨越省份与疆域,以代码相连。 * * 我们希望营造像 Richard Stallman 在创建 GNU 项目之前,在 MIT 时 * 那样的氛围 —— 写自己用得上的软件,与大家一起开发、维护,简单纯 @@ -38,8 +30,8 @@ * 然的加入,逐渐成长为互相支持的伙伴。 * ------------------------------------------------------------*/ -#define Chsrc_Version "0.2.2.3-dev5" -#define Chsrc_Release_Date "2025/08/21" +#define Chsrc_Version "0.2.2.3-dev6" +#define Chsrc_Release_Date "2025/08/22" #define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc" #define Chsrc_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc" @@ -336,7 +328,7 @@ cli_print_target_features (Target_t *target, const char *input_target_name) if (target->note) { char *msg = ENGLISH ? "NOTE: " : "备注: "; - printf ("%s%s\n", bdyellow (msg), bdyellow (target->note)); + printf ("%s%s\n\n", bdyellow (msg), bdyellow (target->note)); } } @@ -469,7 +461,7 @@ match_alias_callback (const char *alias, void *user_data) /** - * 查询用户输入 @param:input 是否与该 @param:menu 中的某个 target 匹配 + * 查询用户输入 `input` 是否与该 `menu` 中的某个 target 匹配 * 若匹配将直接调用 prelude * * @param[in] menu menu @@ -529,7 +521,7 @@ typedef enum { } TargetOp; /** - * 寻找target,并根据 @param:code 执行相应的操作 + * 寻找target,并根据 `code` 执行相应的操作 * * @param input 用户输入的目标 * @param code 对target要执行的操作 From 83e8084d22ee40bd9e9c3b468d5233b36e738d46 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 11:00:41 +0800 Subject: [PATCH 076/103] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20`ProgStore`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/core.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/framework/core.c b/src/framework/core.c index ebe41a4..9b8a5f5 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -9,7 +9,7 @@ * | Yangmoooo * | * Created On : <2023-08-29> - * Last Modified : <2025-08-21> + * Last Modified : <2025-08-22> * * chsrc framework * ------------------------------------------------------------*/ @@ -139,6 +139,19 @@ ProgStatus = }; +/* Global Program Store */ +struct +{ + XySeq_t *pl; + XySeq_t *os; + XySeq_t *wr; +} +ProgStore = +{ + .pl = NULL, + .os = NULL, + .wr = NULL +}; @@ -216,6 +229,10 @@ chsrc_framework_init () xy_init (); ProgStatus.contributors = xy_map_new (); + + ProgStore.pl = xy_seq_new (); + ProgStore.os = xy_seq_new (); + ProgStore.wr = xy_seq_new (); } From 4b11ee3d8b0e410c1b43c91a58e15bb4c334863d Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 11:01:13 +0800 Subject: [PATCH 077/103] =?UTF-8?q?=E9=87=8D=E5=86=99=20`menu.c`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/recipe/menu.c | 167 ++++++++++++++++++++++------------------------ 1 file changed, 79 insertions(+), 88 deletions(-) diff --git a/src/recipe/menu.c b/src/recipe/menu.c index 7491080..32d59c1 100644 --- a/src/recipe/menu.c +++ b/src/recipe/menu.c @@ -5,8 +5,8 @@ * Contributors : Mikachu2333 * | * Created On : <2023-09-01> - * Major Revision : 4 - * Last Modified : <2025-08-20> + * Major Revision : 5 + * Last Modified : <2025-08-22> * ------------------------------------------------------------*/ #include "lang/rawstr4c.h" @@ -104,95 +104,86 @@ #include "ware/Anaconda/Anaconda.c" - -#define t(o) &o##_target, &o##_prelude - -TargetRegisterInfo_t -chsrc_pl_menu[] = +void +chsrc_init_menu () { - {t(pl_ruby)}, - {t(pl_python_group)}, - {t(pl_python_pip)}, - {t(pl_python_poetry)}, - {t(pl_python_pdm)}, - {t(pl_python_rye)}, - {t(pl_python_uv)}, - {t(pl_js_group)}, - {t(pl_js_bun)}, - {t(pl_js_npm)}, - {t(pl_js_yarn)}, - {t(pl_js_pnpm)}, - {t(pl_js_nvm)}, - {t(pl_perl)}, - {t(pl_php)}, - {t(pl_lua)}, - {t(pl_go)}, - {t(pl_rust_cargo)}, - {t(pl_rust_rustup)}, - {t(pl_java)}, - {t(pl_clojure)}, - {t(pl_dart)}, - {t(pl_dart_flutter)}, - {t(pl_nuget)}, - {t(pl_haskell)}, - {t(pl_ocaml)}, - {t(pl_r)}, - {t(pl_julia)}, -}; +#define add(t) xy_seq_push(ProgStore.pl, &pl_##t##_target); (&pl_##t##_target)->preludefn = pl_##t##_prelude + add (ruby); + add (python_group); + add (python_pip); + add (python_poetry); + add (python_pdm); + add (python_rye); + add (python_uv); + add (js_group); + add (js_bun); + add (js_npm); + add (js_yarn); + add (js_pnpm); + add (js_nvm); + add (perl); + add (php); + add (lua); + add (go); + add (rust_cargo); + add (rust_rustup); + add (java); + add (clojure); + add (dart); + add (dart_flutter); + add (nuget); + add (haskell); + add (ocaml); + add (r); + add (julia); +#undef add +#define add(t) xy_seq_push(ProgStore.os, &os_##t##_target); (&os_##t##_target)->preludefn = os_##t##_prelude + add (ubuntu); + add (linuxmint); + add (debian); + add (fedora); + add (opensuse); + add (kali); + add (msys2); + add (arch); + add (archlinuxcn); + add (manjaro); + add (gentoo); + add (rockylinux); + add (almalinux); + add (alpine); + add (voidlinux); + add (solus); + add (trisquel); + add (linuxlite); + add (ros); + add (raspberrypi); + add (armbian); + add (openwrt); + add (termux); + add (openkylin); + add (openeuler); + add (anolis); + add (deepin); + add (freebsd); + add (netbsd); + add (openbsd); +#undef add - -TargetRegisterInfo_t -chsrc_os_menu[] = -{ - {t(os_ubuntu)}, - {t(os_linuxmint)}, - {t(os_debian)}, - {t(os_fedora)}, - {t(os_opensuse)}, - {t(os_kali)}, - {t(os_msys2)}, - {t(os_arch)}, - {t(os_archlinuxcn)}, - {t(os_manjaro)}, - {t(os_gentoo)}, - {t(os_rockylinux)}, - {t(os_almalinux)}, - {t(os_alpine)}, - {t(os_voidlinux)}, - {t(os_solus)}, - {t(os_trisquel)}, - {t(os_linuxlite)}, - {t(os_ros)}, - {t(os_raspberrypi)}, - {t(os_armbian)}, - {t(os_openwrt)}, - {t(os_termux)}, - {t(os_openkylin)}, - {t(os_openeuler)}, - {t(os_anolis)}, - {t(os_deepin)}, - {t(os_freebsd)}, - {t(os_netbsd)}, - {t(os_openbsd)}, -}; - - -TargetRegisterInfo_t -chsrc_wr_menu[] = -{ - {t(wr_winget)}, - {t(wr_homebrew)}, - {t(wr_cocoapods)}, - {t(wr_docker)}, - {t(wr_flatpak)}, - {t(wr_nix)}, - {t(wr_guix)}, - {t(wr_emacs)}, - {t(wr_tex)}, - {t(wr_anaconda)}, -}; -#undef t +#define add(t) xy_seq_push(ProgStore.wr, &wr_##t##_target); (&wr_##t##_target)->preludefn = wr_##t##_prelude + add (winget); + add (homebrew); + add (cocoapods); + add (docker); + add (flatpak); + add (nix); + add (guix); + add (emacs); + add (tex); + add (anaconda); +#undef add +} From 1f81fa4efc897406b98ed10be5d520f633fa8755 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 11:23:19 +0800 Subject: [PATCH 078/103] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20`xy=5Fseq=5Ffind()?= =?UTF-8?q?`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index 1cea7da..40fbeb8 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -8,7 +8,7 @@ * | Mikachu2333 * | * Created On : <2023-08-28> - * Last Modified : <2025-08-21> + * Last Modified : <2025-08-22> * * * xy: 襄阳、咸阳 @@ -22,7 +22,7 @@ #ifndef XY_H #define XY_H -#define _XY_Version "v0.1.7.0-2025/08/21" +#define _XY_Version "v0.1.7.0-2025/08/22" #define _XY_Maintain_URL "https://github.com/RubyMetric/chsrc/blob/dev/lib/xy.h" #define _XY_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc/blob/dev/lib/xy.h" @@ -1367,6 +1367,25 @@ xy_seq_each (XySeq_t *seq, void (*func)(void *)) } } +/** + * @flavor Ruby: Enumerable#find + */ +void * +xy_seq_find (XySeq_t *seq, bool (*func)(void *)) +{ + xy_cant_be_null (seq); + xy_cant_be_null (func); + + for (XySeqItem_t *it = seq->first_item; it; it = it->next) + { + if (func (it->data)) + { + return it->data; + } + } + return NULL; +} + #define _XY_Map_Buckets_Count 97 From 5375a9da196ddda32d3cd7edaab7ed80e634c880 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 11:24:26 +0800 Subject: [PATCH 079/103] =?UTF-8?q?=E9=87=8D=E5=86=99=20`iterate=5Fmenu()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chsrc-main.c | 83 +++++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 39 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index e0dcff6..d87936c 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -122,12 +122,13 @@ cli_print_available_mirrors () /** - * 遍历以 / 为分隔符的别名字符串,对每个别名调用回调函数 + * @brief 遍历以 / 为分隔符的别名字符串,对每个别名调用回调函数 * - * @param aliases 空格分隔的 alias 字符串 - * @param callback 对每个 alias 调用的回调函数 - * @param user_data 传递给回调函数的用户数据 - * @return 如果回调函数返回true则停止遍历并返回true,否则返回false + * @param aliases 空格分隔的 alias 字符串 + * @param callback 对每个 alias 调用的回调函数 + * @param user_data 传递给回调函数的用户数据 + * + * @return 如果回调函数返回true则停止遍历并返回true,否则返回false */ bool iterate_aliases (const char *aliases, bool (*callback)(const char *alias, void *user_data), void *user_data) @@ -166,7 +167,7 @@ iterate_aliases (const char *aliases, bool (*callback)(const char *alias, void * * 用于 cli_print_supported_targets_ 的回调函数,打印每个别名 */ bool -print_alias_callback (const char *alias, void *user_data) +callback_print_alias (const char *alias, void *user_data) { printf ("%s ", alias); return false; // 继续遍历,不停止 @@ -180,7 +181,7 @@ cli_print_supported_targets_ (TargetRegisterInfo_t menu[], size_t size) TargetRegisterInfo_t *entry = &menu[i]; // 使用通用的别名遍历函数打印所有别名 - iterate_aliases (entry->target->aliases, print_alias_callback, NULL); + iterate_aliases (entry->target->aliases, callback_print_alias, NULL); br(); // 每个target换行 } @@ -450,53 +451,56 @@ cli_print_issues () /** - * 用于 iterate_menu_ 的回调函数,检查别名是否匹配用户输入 + * @brief 用于 callback_find_target() 的回调函数,检查别名是否匹配用户输入 */ bool -match_alias_callback (const char *alias, void *user_data) +callback_match_alias (const char *alias, void *user_data) { const char *input = (const char *)user_data; return xy_streql_ic (input, alias); } +/** + * @brief 用于 iterate_menu() 的回调函数 + */ +bool +callback_find_target (void *data) +{ + target = (Target_t *) data; + if (iterate_aliases (target->aliases, callback_match_alias, (void *)input)) + { + target->prelude(); + + return true; + } +} /** * 查询用户输入 `input` 是否与该 `menu` 中的某个 target 匹配 * 若匹配将直接调用 prelude * - * @param[in] menu menu - * @param[in] size menu 大小 - * @param[in] input 用户输入的目标名 - * @param[out] target 返回匹配到的 Target_t 指针 + * @param[in] menu menu + * @param[in] input 用户输入的目标名 + * @param[out] target 返回匹配到的 Target_t 指针 * * @return 匹配到则返回true,未匹配到则返回false */ -#define iterate_menu(ary, input, target) iterate_menu_(ary, xy_arylen(ary), input, target) bool -iterate_menu_ (TargetRegisterInfo_t menu[], size_t size, const char *input, Target_t **target) +iterate_menu (XySeq_t *menu, const char *input, Target_t **target) { - for (int i = 0; i < size; i++) + Target_t *t = xy_seq_find (menu, callback_find_target); + + if (t) { - TargetRegisterInfo_t *entry = &menu[i]; - - if (iterate_aliases (entry->target->aliases, match_alias_callback, (void *)input)) - { - if (entry->prelude) - { - entry->prelude(); - } - else - { - chsrc_error ("该target未定义 prelude()"); - } - - *target = entry->target; - return true; - } + *target = t; + t->preludefn(); + return true; + } + else + { + *target = NULL; + return false; } - - *target = NULL; - return false; } @@ -536,9 +540,9 @@ get_target (const char *input, TargetOp code, char *option) Target_t *target = NULL; - bool matched = iterate_menu (chsrc_pl_menu, input, &target); - if (!matched) matched = iterate_menu (chsrc_os_menu, input, &target); - if (!matched) matched = iterate_menu (chsrc_wr_menu, input, &target); + bool matched = iterate_menu (ProgStore.pl, input, &target); + if (!matched) matched = iterate_menu (ProgStore.os, input, &target); + if (!matched) matched = iterate_menu (ProgStore.wr, input, &target); if (!matched) return false; @@ -623,7 +627,8 @@ get_target (const char *input, TargetOp code, char *option) int main (int argc, char const *argv[]) { - chsrc_framework_init (); + chsrc_init_framework (); + chsrc_init_menu (); argc -= 1; From ed4545d9f29c8d9bc9a6bb43d861a162f88aebcc Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 11:29:58 +0800 Subject: [PATCH 080/103] =?UTF-8?q?=E5=B0=86=20`contributors`=20=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=8C=AA=E8=87=B3=20`ProgStore`=20=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/chef.c | 6 +++--- src/framework/core.c | 12 +++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/framework/chef.c b/src/framework/chef.c index 5352459..be3b39a 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -5,7 +5,7 @@ * File Authors : 曾奥然 * Contributors : Nul None * Created On : <2025-08-09> - * Last Modified : <2025-08-21> + * Last Modified : <2025-08-22> * * chef DSL: for chefs (recipe makers) to define a target * ------------------------------------------------------------*/ @@ -39,7 +39,7 @@ chef_register_contributor (char *id, char *name, char *email, char *display_name else contributor->display_name = xy_strdup (display_name); - xy_map_set (ProgStatus.contributors, id, contributor); + xy_map_set (ProgStore.contributors, id, contributor); } @@ -187,7 +187,7 @@ chef_verify_contributor (const char *id) { xy_cant_be_null (id); - Contributor_t *c = xy_map_get (ProgStatus.contributors, id); + Contributor_t *c = xy_map_get (ProgStore.contributors, id); if (!c) { char error[256]; diff --git a/src/framework/core.c b/src/framework/core.c index 9b8a5f5..d2b90b1 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -122,8 +122,6 @@ typedef enum ChgType_t /* Global Program Status */ struct { - XyMap_t *contributors; /* 所有贡献者 */ - int leader_selected_index; /* leader target 选中的索引 */ ChgType_t chgtype; /* 换源实现的类型 */ @@ -132,7 +130,6 @@ struct } ProgStatus = { - .contributors = NULL, .leader_selected_index = -1, .chgtype = ChgType_Auto, .chsrc_run_faas = false @@ -145,12 +142,14 @@ struct XySeq_t *pl; XySeq_t *os; XySeq_t *wr; + XyMap_t *contributors; /* 所有贡献者 */ } ProgStore = { .pl = NULL, .os = NULL, - .wr = NULL + .wr = NULL, + .contributors = NULL, }; @@ -224,12 +223,11 @@ chsrc_alert2 (const char *str) void -chsrc_framework_init () +chsrc_init_framework () { xy_init (); - ProgStatus.contributors = xy_map_new (); - + ProgStore.contributors = xy_map_new (); ProgStore.pl = xy_seq_new (); ProgStore.os = xy_seq_new (); ProgStore.wr = xy_seq_new (); From 1eb0e7ee063449a3948aafed444093976b47432f Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 12:11:41 +0800 Subject: [PATCH 081/103] =?UTF-8?q?=E9=87=8D=E6=9E=84=E9=83=A8=E5=88=86=20?= =?UTF-8?q?cli=5Fprint=20=E5=87=BD=E6=95=B0=E9=87=8D=E6=96=B0=E4=BD=BF?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chsrc-main.c | 123 +++++++++++++++++++++++++++-------------------- 1 file changed, 70 insertions(+), 53 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index d87936c..b134758 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -164,7 +164,7 @@ iterate_aliases (const char *aliases, bool (*callback)(const char *alias, void * /** - * 用于 cli_print_supported_targets_ 的回调函数,打印每个别名 + * 用于 cli_print_targets_for_menu 的回调函数,打印每个别名 */ bool callback_print_alias (const char *alias, void *user_data) @@ -174,17 +174,18 @@ callback_print_alias (const char *alias, void *user_data) } void -cli_print_supported_targets_ (TargetRegisterInfo_t menu[], size_t size) +callback_print_targets (void *data) { - for (int i = 0; i < size; i++) - { - TargetRegisterInfo_t *entry = &menu[i]; + Target_t *target = (Target_t *) data; + // 使用通用的别名遍历函数打印所有别名 + iterate_aliases (target->aliases, callback_print_alias, NULL); + br(); // 每个target换行 +} - // 使用通用的别名遍历函数打印所有别名 - iterate_aliases (entry->target->aliases, callback_print_alias, NULL); - - br(); // 每个target换行 - } +void +cli_print_targets_for_menu (XySeq_t *menu) +{ + xy_seq_each (menu, callback_print_targets); br(); // 最后额外换行 } @@ -201,50 +202,51 @@ cli_print_supported_targets () char *msg = ENGLISH ? "Programming Languages" : "编程语言"; say (bdgreen(msg)); say ("-------------------------"); - cli_print_supported_targets_ (chsrc_pl_menu, xy_arylen(chsrc_pl_menu)); + cli_print_targets_for_menu (ProgStore.pl); } { char *msg = ENGLISH ? "Operating Systems" : "操作系统"; say (bdgreen(msg)); say ("-------------------------"); - cli_print_supported_targets_ (chsrc_os_menu, xy_arylen(chsrc_os_menu)); + cli_print_targets_for_menu (ProgStore.os); } { char *msg = ENGLISH ? "Softwares" : "软件"; say (bdgreen(msg)); say ("-------------------------"); - cli_print_supported_targets_ (chsrc_wr_menu, xy_arylen(chsrc_wr_menu)); + cli_print_targets_for_menu (ProgStore.wr); } } void -cli_print_supported_pl () +cli_print_menu (char *menu) { - char *msg = ENGLISH ? "Support following Programming Languages (same line indicates these targets are compatible)\n" - : "支持对以下编程语言生态换源 (同一行表示这几个目标兼容)\n"; - say (bdgreen(msg)); - - cli_print_supported_targets_ (chsrc_pl_menu, xy_arylen(chsrc_pl_menu)); -} - -void -cli_print_supported_os () -{ - char *msg = ENGLISH ? "Support following Operating Systems (same line indicates these targets are compatible)\n" - : "支持对以下操作系统换源 (同一行表示这几个目标兼容)\n"; - say (bdgreen(msg)); - cli_print_supported_targets_ (chsrc_os_menu, xy_arylen(chsrc_os_menu)); -} - -void -cli_print_supported_wr () -{ - char *msg = ENGLISH ? "Support following Softwares (same line indicates these targets are compatible)\n" - : "支持对以下软件换源 (同一行表示这几个目标兼容)\n"; - say (bdgreen(msg)); - cli_print_supported_targets_ (chsrc_wr_menu, xy_arylen(chsrc_wr_menu)); + if (xy_streql (menu, "pl")) + { + char *msg = + ENGLISH ? "Support following Programming Languages (same line indicates these targets are compatible)\n" + : "支持对以下编程语言生态换源 (同一行表示这几个目标兼容)\n"; + say (bdgreen(msg)); + cli_print_targets_for_menu (ProgStore.pl); + } + else if (xy_streql (menu, "os")) + { + char *msg = + ENGLISH ? "Support following Operating Systems (same line indicates these targets are compatible)\n" + : "支持对以下操作系统换源 (同一行表示这几个目标兼容)\n"; + say (bdgreen(msg)); + cli_print_targets_for_menu (ProgStore.os); + } + else if (xy_streql (menu, "wr")) + { + char *msg = + ENGLISH ? "Support following Softwares (same line indicates these targets are compatible)\n" + : "支持对以下软件换源 (同一行表示这几个目标兼容)\n"; + say (bdgreen(msg)); + cli_print_targets_for_menu (ProgStore.wr); + } } @@ -464,15 +466,16 @@ callback_match_alias (const char *alias, void *user_data) * @brief 用于 iterate_menu() 的回调函数 */ bool -callback_find_target (void *data) +callback_is_one_of_target_aliases (void *data, void *input) { - target = (Target_t *) data; - if (iterate_aliases (target->aliases, callback_match_alias, (void *)input)) + Target_t *target = (Target_t *) data; + if (iterate_aliases (target->aliases, callback_match_alias, input)) { - target->prelude(); - + target->preludefn(); return true; } + else + return false; } /** @@ -486,9 +489,9 @@ callback_find_target (void *data) * @return 匹配到则返回true,未匹配到则返回false */ bool -iterate_menu (XySeq_t *menu, const char *input, Target_t **target) +iterate_menu (XySeq_t *menu, const char *input, Target_t **target) { - Target_t *t = xy_seq_find (menu, callback_find_target); + Target_t *t = xy_seq_find (menu, callback_is_one_of_target_aliases, (void *) input); if (t) { @@ -754,25 +757,39 @@ main (int argc, char const *argv[]) else { target = argv[cli_arg_Target_pos]; - if (xy_streql (target, "mirrors") || xy_streql (target, "mirror")) + if ( xy_streql (target, "mirrors") + || xy_streql (target, "mirror")) { - cli_print_available_mirrors (); return Exit_OK; + cli_print_available_mirrors (); + return Exit_OK; } - else if (xy_streql (target, "targets") || xy_streql (target, "target")) + + else if ( xy_streql (target, "targets") + || xy_streql (target, "target")) { - cli_print_supported_targets (); return Exit_OK; + cli_print_supported_targets (); + return Exit_OK; } + else if (xy_streql (target, "os")) { - cli_print_supported_os (); return Exit_OK; + cli_print_menu ("os"); + return Exit_OK; } - else if (xy_streql (target, "lang") || xy_streql (target, "pl") || xy_streql (target, "language")) + + else if ( xy_streql (target, "lang") + || xy_streql (target, "pl") + || xy_streql (target, "language")) { - cli_print_supported_pl(); return Exit_OK; + cli_print_menu ("pl"); + return Exit_OK; } - else if (xy_streql (target, "ware") || xy_streql (target, "software")) + + else if ( xy_streql (target, "ware") + || xy_streql (target, "software")) { - cli_print_supported_wr (); return Exit_OK; + cli_print_menu ("wr"); + return Exit_OK; } matched = get_target (target, TargetOp_List_Config, NULL); From eb995e055df6c433cb53500a649fb9b83f379cea Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 12:16:53 +0800 Subject: [PATCH 082/103] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20user=5Fdata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 15 +++++++++------ test/xy.c | 10 +++++----- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index 40fbeb8..a5a55a8 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -1356,14 +1356,14 @@ xy_seq_pop (XySeq_t *seq) * @flavor Ruby: Array#each */ void -xy_seq_each (XySeq_t *seq, void (*func)(void *)) +xy_seq_each (XySeq_t *seq, void (*func) (void *, void *), void *user_data) { xy_cant_be_null (seq); xy_cant_be_null (func); for (XySeqItem_t *it = seq->first_item; it; it = it->next) { - func (it->data); + func (it->data, user_data); } } @@ -1371,14 +1371,14 @@ xy_seq_each (XySeq_t *seq, void (*func)(void *)) * @flavor Ruby: Enumerable#find */ void * -xy_seq_find (XySeq_t *seq, bool (*func)(void *)) +xy_seq_find (XySeq_t *seq, bool (*func) (void *, void *), void *user_data) { xy_cant_be_null (seq); xy_cant_be_null (func); for (XySeqItem_t *it = seq->first_item; it; it = it->next) { - if (func (it->data)) + if (func (it->data, user_data)) { return it->data; } @@ -1503,7 +1503,10 @@ xy_map_get (XyMap_t *map, const char *key) * @flavor Ruby: Hash#each */ void -xy_map_each (XyMap_t *map, void (*func)(const char *key, void *value)) +xy_map_each ( + XyMap_t *map, + void (*func) (const char *key, void *value, void *user_data), + void *user_data) { xy_cant_be_null (map); xy_cant_be_null (func); @@ -1513,7 +1516,7 @@ xy_map_each (XyMap_t *map, void (*func)(const char *key, void *value)) struct _XyHashBucket_t *bucket = map->buckets[i]; while (bucket) { - func (bucket->key, bucket->value); + func (bucket->key, bucket->value, user_data); bucket = bucket->next; } } diff --git a/test/xy.c b/test/xy.c index 26f0826..315a70c 100644 --- a/test/xy.c +++ b/test/xy.c @@ -5,7 +5,7 @@ * Test Authors : 曾奥然 * Contributors : Mikachu2333 * Created On : <2023-08-30> - * Last Modified : <2025-08-21> + * Last Modified : <2025-08-22> * * Test xy.h * ------------------------------------------------------------*/ @@ -13,13 +13,13 @@ #include "xy.h" void -print_str_for_seq (void *str) +print_str_for_seq (void *str, void *NOUSE) { print ((char *) str); } void -print_str_for_map (const char *key, void *value) +print_str_for_map (const char *key, void *value, void *NOUSE) { println (xy_strcat (4, " ", key, " => ", (char *) value)); } @@ -150,7 +150,7 @@ main (int argc, char const *argv[]) xy_seq_push (seq, "World"); assert_str ("Hello", xy_seq_at (seq, 1)); assert_str ("World", xy_seq_at (seq, 2)); - xy_seq_each (seq, print_str_for_seq); br(); + xy_seq_each (seq, print_str_for_seq, NULL); br(); xy_seq_pop (seq); assert (1 == xy_seq_len (seq)); @@ -164,7 +164,7 @@ main (int argc, char const *argv[]) assert_str ("chsrc", xy_map_get (map, "Hello")); assert (2 == xy_map_len (map)); echo ("{"); - xy_map_each (map, print_str_for_map); + xy_map_each (map, print_str_for_map, NULL); echo ("}"); xy_succ ("测试完成", "xy.h 测试全部通过"); From 0a51b7ebd8d3ef1b30a5a16c6d4dd40894157bd8 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 12:27:34 +0800 Subject: [PATCH 083/103] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20last=20me?= =?UTF-8?q?ssage=20=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chsrc-main.c | 12 ++++++------ src/rawstr4c.h | 2 +- src/rawstr4c.md | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index b134758..3063aea 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -174,7 +174,7 @@ callback_print_alias (const char *alias, void *user_data) } void -callback_print_targets (void *data) +callback_print_targets (void *data, void *NOUSE) { Target_t *target = (Target_t *) data; // 使用通用的别名遍历函数打印所有别名 @@ -185,7 +185,7 @@ callback_print_targets (void *data) void cli_print_targets_for_menu (XySeq_t *menu) { - xy_seq_each (menu, callback_print_targets); + xy_seq_each (menu, callback_print_targets, NULL); br(); // 最后额外换行 } @@ -508,13 +508,13 @@ iterate_menu (XySeq_t *menu, const char *input, Target_t **target) /** - * 我们总是最后告诉用户一些维护信息 + * @brief 在必要的时期,最后告诉用户一些信息 */ void -cli_notify_lastly_for_users () +chsrc_op_epilogue () { br(); - chsrc_note2 (RAWSTR_chsrc_last_message); + chsrc_note2 (RAWSTR_chsrc_op_epilogue); } @@ -617,7 +617,7 @@ get_target (const char *input, TargetOp code, char *option) if (TargetOp_Set_Source==code || TargetOp_Measure_Source==code) { - cli_notify_lastly_for_users(); + chsrc_op_epilogue (); } chef_debug_target (target); diff --git a/src/rawstr4c.h b/src/rawstr4c.h index 9fc19aa..3cb50f9 100644 --- a/src/rawstr4c.h +++ b/src/rawstr4c.h @@ -12,5 +12,5 @@ char RAWSTR_chsrc_for_v[] = "\143\150\163\162\143\040\100\166\145\162\100\012\10 char RAWSTR_chsrc_for_issue[] = "\346\210\221\344\273\254\345\220\214\346\227\266\345\234\250\040\107\151\164\110\165\142\040\345\222\214\040\107\151\164\145\145\040\346\216\245\345\217\227\040\151\163\163\165\145\040\345\222\214\040\102\165\147\040\346\212\245\345\221\212\072\012\012\040\040\055\040\150\164\164\160\163\072\057\057\147\151\164\150\165\142\056\143\157\155\057\122\165\142\171\115\145\164\162\151\143\057\143\150\163\162\143\057\151\163\163\165\145\163\012\040\040\055\040\150\164\164\160\163\072\057\057\147\151\164\145\145\056\143\157\155\057\122\165\142\171\115\145\164\162\151\143\057\143\150\163\162\143\057\151\163\163\165\145\163\012\012\012\346\254\242\350\277\216\345\217\202\344\270\216\345\205\267\344\275\223\344\273\273\345\212\241\072\012\012\040\040\040\123\150\145\154\154\040\141\165\164\157\055\143\157\155\160\154\145\164\151\157\156\040\347\273\210\347\253\257\345\221\275\344\273\244\350\207\252\345\212\250\350\241\245\345\205\250\072\012\012\040\040\040\040\040\040\040\040\150\164\164\160\163\072\057\057\147\151\164\150\165\142\056\143\157\155\057\122\165\142\171\115\145\164\162\151\143\057\143\150\163\162\143\057\151\163\163\165\145\163\057\062\060\064\012\012\040\040\040\346\220\234\351\233\206\344\270\212\346\270\270\351\273\230\350\256\244\346\272\220\345\234\260\345\235\200\357\274\214\345\270\256\345\212\251\350\277\233\350\241\214\040\143\150\163\162\143\040\162\145\163\145\164\072\012\012\040\040\040\040\040\040\040\040\150\164\164\160\163\072\057\057\147\151\164\150\165\142\056\143\157\155\057\122\165\142\171\115\145\164\162\151\143\057\143\150\163\162\143\057\151\163\163\165\145\163\057\061\061\061\012\012\040\040\040\346\220\234\351\233\206\346\265\213\351\200\237\345\234\260\345\235\200\357\274\214\350\277\233\350\241\214\347\262\276\345\207\206\346\265\213\351\200\237\072\012\012\040\040\040\040\040\040\040\040\150\164\164\160\163\072\057\057\147\151\164\150\165\142\056\143\157\155\057\122\165\142\171\115\145\164\162\151\143\057\143\150\163\162\143\057\151\163\163\165\145\163\057\062\060\065\012\012\040\040\040\345\270\256\345\212\251\346\262\241\346\234\211\351\242\204\347\274\226\350\257\221\347\232\204\345\271\263\345\217\260\347\274\226\345\206\231\040\163\150\145\154\154\040\350\204\232\346\234\254\072\012\012\040\040\040\040\040\040\040\040\150\164\164\160\163\072\057\057\147\151\164\150\165\142\056\143\157\155\057\122\165\142\171\115\145\164\162\151\143\057\143\150\163\162\143\057\151\163\163\165\145\163\057\062\063\060\012\012\012\346\224\257\346\214\201\347\232\204\351\200\232\347\224\250\351\225\234\345\203\217\347\253\231\072\012\040\040\055\040\150\164\164\160\163\072\057\057\147\151\164\150\165\142\056\143\157\155\057\122\165\142\171\115\145\164\162\151\143\057\143\150\163\162\143\057\167\151\153\151\012"; -char RAWSTR_chsrc_last_message[] = "\012\040\040\040\052\040\347\262\276\345\207\206\346\265\213\351\200\237\072\040\350\203\275\347\234\237\345\256\236\345\217\215\346\230\240\344\275\240\346\234\252\346\235\245\344\275\277\347\224\250\350\257\245\350\265\204\346\272\220\346\227\266\347\232\204\351\200\237\345\272\246\357\274\214\345\233\240\344\270\272\345\256\203\347\233\264\346\216\245\346\265\213\351\207\217\344\275\240\345\205\263\346\263\250\347\232\204\351\202\243\344\270\252\350\265\204\346\272\220\343\200\202\012\040\040\040\052\040\346\250\241\347\263\212\346\265\213\351\200\237\072\040\344\273\205\344\273\243\350\241\250\350\257\245\351\225\234\345\203\217\347\253\231\346\217\220\344\276\233\346\234\215\345\212\241\347\232\204\344\270\200\344\270\252\345\217\257\350\203\275\351\200\237\345\272\246\343\200\202\345\233\240\350\200\214\345\217\257\350\203\275\344\274\232\345\207\272\347\216\260\346\265\213\351\200\237\346\225\260\345\200\274\350\276\203\351\253\230\357\274\214\344\275\206\345\256\236\351\231\205\344\275\277\347\224\250\344\275\223\351\252\214\344\270\215\344\275\263\347\232\204\347\216\260\350\261\241\343\200\202\012\345\275\223\344\275\240\351\201\207\345\210\260\346\250\241\347\263\212\346\265\213\351\200\237\346\227\266\357\274\214\350\257\267\345\260\275\345\217\257\350\203\275\345\220\221\346\210\221\344\273\254\346\217\220\344\272\244\345\207\206\347\241\256\347\232\204\346\265\213\351\200\237\351\223\276\346\216\245\072\040\143\150\163\162\143\040\151\163\163\165\145"; +char RAWSTR_chsrc_op_epilogue[] = "\012\040\040\040\052\040\347\262\276\345\207\206\346\265\213\351\200\237\072\040\350\203\275\347\234\237\345\256\236\345\217\215\346\230\240\344\275\240\346\234\252\346\235\245\344\275\277\347\224\250\350\257\245\350\265\204\346\272\220\346\227\266\347\232\204\351\200\237\345\272\246\357\274\214\345\233\240\344\270\272\345\256\203\347\233\264\346\216\245\346\265\213\351\207\217\344\275\240\345\205\263\346\263\250\347\232\204\351\202\243\344\270\252\350\265\204\346\272\220\343\200\202\012\040\040\040\052\040\346\250\241\347\263\212\346\265\213\351\200\237\072\040\344\273\205\344\273\243\350\241\250\350\257\245\351\225\234\345\203\217\347\253\231\346\217\220\344\276\233\346\234\215\345\212\241\347\232\204\344\270\200\344\270\252\345\217\257\350\203\275\351\200\237\345\272\246\343\200\202\345\233\240\350\200\214\345\217\257\350\203\275\344\274\232\345\207\272\347\216\260\346\265\213\351\200\237\346\225\260\345\200\274\350\276\203\351\253\230\357\274\214\344\275\206\345\256\236\351\231\205\344\275\277\347\224\250\344\275\223\351\252\214\344\270\215\344\275\263\347\232\204\347\216\260\350\261\241\343\200\202\012\345\275\223\344\275\240\351\201\207\345\210\260\346\250\241\347\263\212\346\265\213\351\200\237\346\227\266\357\274\214\350\257\267\345\260\275\345\217\257\350\203\275\345\220\221\346\210\221\344\273\254\346\217\220\344\272\244\345\207\206\347\241\256\347\232\204\346\265\213\351\200\237\351\223\276\346\216\245\072\040\143\150\163\162\143\040\151\163\163\165\145"; diff --git a/src/rawstr4c.md b/src/rawstr4c.md index 86071bc..0447e3f 100644 --- a/src/rawstr4c.md +++ b/src/rawstr4c.md @@ -2,10 +2,10 @@ ! SPDX-License-Identifier: GPL-3.0-or-later ! ------------------------------------------------------------- ! Config Type : rawstr4c (Markdown) - ! Config Authors: Aoran Zeng - ! Contributors : Nil Null + ! Config Authors: 曾奥然 + ! Contributors : Nil Null ! Created On : <2025-07-22> - ! Last Modified : <2025-08-09> + ! Last Modified : <2025-08-22> ! ---------------------------------------------------------- --> # [rawstr4c] input for chsrc @@ -189,7 +189,7 @@ Written by Aoran Zeng, Heng Guo and contributors. (See chsrc-main.c) ## 最后告诉用户一些维护信息 -- name = `last_message` +- name = `op_epilogue` ``` From 12e69edb86c99f561751ccc3e3d7ea3630d9ddea Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 13:06:55 +0800 Subject: [PATCH 084/103] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20`chef=5Fprep=5Fthi?= =?UTF-8?q?s()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/chef.c | 5 ----- src/framework/struct.h | 14 ++++++++++++-- src/recipe/recipe-template.c | 9 +++------ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/framework/chef.c b/src/framework/chef.c index be3b39a..16e4956 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -12,11 +12,6 @@ #pragma once -#define chef_allow_gsr(t) this->getfn = t##_getsrc; this->setfn = t##_setsrc; this->resetfn = t##_resetsrc; -#define chef_allow_s(t) this->getfn = NULL; this->setfn = t##_setsrc; this->resetfn = NULL; -#define chef_allow_sr(t) this->getfn = NULL; this->setfn = t##_setsrc; this->resetfn = t##_resetsrc; -#define chef_allow_gs(t) this->getfn = t##_getsrc; this->setfn = t##_setsrc; this->resetfn = NULL; - /** * @brief 登记所有贡献者 * diff --git a/src/framework/struct.h b/src/framework/struct.h index 7b2f50e..ab9d123 100644 --- a/src/framework/struct.h +++ b/src/framework/struct.h @@ -126,6 +126,10 @@ typedef struct Target_t void (*setfn) (char *option); void (*resetfn) (char *option); + /* 初始化函数,用于填充该 struct 的各种信息 */ + void (*preludefn) (void); + bool inited; /* 是否执行过了 preludefn() */ + Source_t *sources; size_t sources_n; @@ -167,9 +171,15 @@ TargetRegisterInfo_t; #define def_target(t, aliases) void t##_getsrc(char *option);void t##_setsrc(char *option);void t##_resetsrc(char *option); Target_t t##_target={aliases}; -/* 以下宏仅能放在 prelude() 中使用 */ +#define chef_allow_gsr(t) this->getfn = t##_getsrc; this->setfn = t##_setsrc; this->resetfn = t##_resetsrc; +#define chef_allow_s(t) this->getfn = NULL; this->setfn = t##_setsrc; this->resetfn = NULL; +#define chef_allow_sr(t) this->getfn = NULL; this->setfn = t##_setsrc; this->resetfn = t##_resetsrc; +#define chef_allow_gs(t) this->getfn = t##_getsrc; this->setfn = t##_setsrc; this->resetfn = NULL; +#define chef_allow_NOOP(t) +#define chef_prep_this(t,op) Target_t *this = &t##_target; this->inited = true; chef_allow_##op(t); + #define use_this(t) Target_t *this = &t##_target; -#define use_this_source(t) use_this(t); Source_t source = chsrc_yield_source_and_confirm (this, option); +#define use_this_source(t) Target_t *this = &t##_target; Source_t source = chsrc_yield_source_and_confirm (this, option); #define def_sources_begin() Source_t sources[] = { #define def_sources_end() }; \ diff --git a/src/recipe/recipe-template.c b/src/recipe/recipe-template.c index 41a1549..1d2c2d1 100644 --- a/src/recipe/recipe-template.c +++ b/src/recipe/recipe-template.c @@ -6,7 +6,7 @@ * Contributors : Mikachu2333 * | * Created On : <2024-08-09> - * Last Modified : <2025-08-21> + * Last Modified : <2025-08-22> * ------------------------------------------------------------- * 本文件作为一个通用模板: * @@ -58,11 +58,8 @@ RubyMetric = { void __prelude (void) { - use_this(_); - chef_allow_gsr(_); // 代表支持 Get Set Reset 三种操作 - // chef_allow_s(_); // 以此类推 - // chef_allow_gs(_); - // chef_allow_sr(_); + // op 可以为 NOOP|s|sr|gsr|gs, 代表支持 Get Set Reset 三种操作 + chef_prep_this (_, op); chef_set_created_on (this, "2024-08-09"); // 文件创建日期 chef_set_last_updated (this, "2025-08-12"); // 文件最后一次更新日期 From adca7b3ea27161bb94fb75fccd422a5690ef694e Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 13:08:27 +0800 Subject: [PATCH 085/103] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20`chef=5Fprep=5Fthi?= =?UTF-8?q?s()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/recipe/lang/Clojure.c | 3 +-- src/recipe/lang/Dart/Flutter.c | 3 +-- src/recipe/lang/Dart/Pub.c | 3 +-- src/recipe/lang/Go.c | 3 +-- src/recipe/lang/Haskell.c | 3 +-- src/recipe/lang/Java.c | 3 +-- src/recipe/lang/JavaScript/Bun.c | 3 +-- src/recipe/lang/JavaScript/JavaScript.c | 3 +-- src/recipe/lang/JavaScript/Yarn.c | 3 +-- src/recipe/lang/JavaScript/common.h | 6 ++---- src/recipe/lang/JavaScript/npm.c | 3 +-- src/recipe/lang/JavaScript/nvm.c | 3 +-- src/recipe/lang/JavaScript/pnpm.c | 3 +-- src/recipe/lang/Julia.c | 3 +-- src/recipe/lang/Lua.c | 6 ++---- src/recipe/lang/NuGet.c | 3 +-- src/recipe/lang/OCaml.c | 3 +-- src/recipe/lang/PHP.c | 6 ++---- src/recipe/lang/Perl.c | 3 +-- src/recipe/lang/Python/PDM.c | 6 +----- src/recipe/lang/Python/Poetry.c | 3 +-- src/recipe/lang/Python/Python.c | 3 +-- src/recipe/lang/Python/Rye.c | 3 +-- src/recipe/lang/Python/common.h | 5 ++--- src/recipe/lang/Python/pip.c | 3 +-- src/recipe/lang/Python/uv.c | 3 +-- src/recipe/lang/R.c | 3 +-- src/recipe/lang/Ruby/Ruby.c | 3 +-- src/recipe/lang/Rust/Cargo.c | 3 +-- src/recipe/lang/Rust/rustup.c | 3 +-- src/recipe/os/APT/Armbian.c | 3 +-- src/recipe/os/APT/Debian.c | 3 +-- src/recipe/os/APT/Kali-Linux.c | 3 +-- src/recipe/os/APT/Linux-Lite.c | 3 +-- src/recipe/os/APT/Linux-Mint.c | 3 +-- src/recipe/os/APT/ROS.c | 3 +-- src/recipe/os/APT/Raspberry-Pi-OS.c | 3 +-- src/recipe/os/APT/Termux.c | 3 +-- src/recipe/os/APT/Trisquel.c | 3 +-- src/recipe/os/APT/Ubuntu.c | 3 +-- src/recipe/os/APT/deepin.c | 3 +-- src/recipe/os/APT/openKylin.c | 3 +-- src/recipe/os/Alpine-Linux.c | 3 +-- src/recipe/os/BSD/FreeBSD.c | 5 ++--- src/recipe/os/BSD/NetBSD.c | 3 +-- src/recipe/os/BSD/OpenBSD.c | 3 +-- src/recipe/os/Gentoo-Linux.c | 3 +-- src/recipe/os/OpenWrt.c | 3 +-- src/recipe/os/Solus.c | 3 +-- src/recipe/os/Void-Linux.c | 3 +-- src/recipe/os/YUM/AlmaLinux.c | 3 +-- src/recipe/os/YUM/Anolis-OS.c | 3 +-- src/recipe/os/YUM/Fedora-Linux.c | 3 +-- src/recipe/os/YUM/Rocky-Linux.c | 3 +-- src/recipe/os/YUM/openEuler.c | 3 +-- src/recipe/os/openSUSE.c | 3 +-- src/recipe/os/pacman/Arch-Linux.c | 6 ++---- src/recipe/os/pacman/MSYS2.c | 3 +-- src/recipe/os/pacman/Manjaro-Linux.c | 3 +-- src/recipe/ware/Anaconda/Anaconda.c | 3 +-- src/recipe/ware/CocoaPods.c | 3 +-- src/recipe/ware/Docker/Docker.c | 3 +-- src/recipe/ware/Emacs.c | 3 +-- src/recipe/ware/Flatpak.c | 3 +-- src/recipe/ware/Guix.c | 3 +-- src/recipe/ware/Homebrew/Homebrew.c | 3 +-- src/recipe/ware/Nix.c | 3 +-- src/recipe/ware/TeX-Live.c | 3 +-- src/recipe/ware/WinGet.c | 3 +-- 69 files changed, 75 insertions(+), 151 deletions(-) diff --git a/src/recipe/lang/Clojure.c b/src/recipe/lang/Clojure.c index 1f52d59..105b5c6 100644 --- a/src/recipe/lang/Clojure.c +++ b/src/recipe/lang/Clojure.c @@ -7,8 +7,7 @@ def_target(pl_clojure, "clojure/clojars/cloj/lein"); void pl_clojure_prelude () { - use_this(pl_clojure); - chef_allow_s(pl_clojure); + chef_prep_this (pl_clojure, s); chef_set_created_on (this, "2023-09-10"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/lang/Dart/Flutter.c b/src/recipe/lang/Dart/Flutter.c index ae04192..6363bc3 100644 --- a/src/recipe/lang/Dart/Flutter.c +++ b/src/recipe/lang/Dart/Flutter.c @@ -7,8 +7,7 @@ def_target(pl_dart_flutter, "flutter"); void pl_dart_flutter_prelude (void) { - use_this(pl_dart_flutter); - chef_allow_gsr(pl_dart_flutter); + chef_prep_this (pl_dart_flutter, gsr); chef_set_created_on (this, "2023-09-10"); chef_set_last_updated (this, "2025-07-11"); diff --git a/src/recipe/lang/Dart/Pub.c b/src/recipe/lang/Dart/Pub.c index fa3990f..99117e3 100644 --- a/src/recipe/lang/Dart/Pub.c +++ b/src/recipe/lang/Dart/Pub.c @@ -7,8 +7,7 @@ def_target(pl_dart, "dart/pub"); void pl_dart_prelude (void) { - use_this(pl_dart); - chef_allow_gsr(pl_dart); + chef_prep_this (pl_dart, gsr); chef_set_created_on (this, "2023-09-10"); chef_set_last_updated (this, "2025-07-11"); diff --git a/src/recipe/lang/Go.c b/src/recipe/lang/Go.c index f1b9ae4..7cc5edc 100644 --- a/src/recipe/lang/Go.c +++ b/src/recipe/lang/Go.c @@ -21,8 +21,7 @@ def_target(pl_go, "go/golang/goproxy"); void pl_go_prelude () { - use_this(pl_go); - chef_allow_gsr(pl_go); + chef_prep_this (pl_go, gsr); chef_set_created_on (this, "2023-08-30"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/lang/Haskell.c b/src/recipe/lang/Haskell.c index 4e8f901..7231432 100644 --- a/src/recipe/lang/Haskell.c +++ b/src/recipe/lang/Haskell.c @@ -7,8 +7,7 @@ def_target(pl_haskell, "haskell/cabal/stack/hackage"); void pl_haskell_prelude () { - use_this(pl_haskell); - chef_allow_s(pl_haskell); + chef_prep_this (pl_haskell, s); chef_set_created_on (this, "2023-09-10"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/lang/Java.c b/src/recipe/lang/Java.c index f00a9fb..548700d 100644 --- a/src/recipe/lang/Java.c +++ b/src/recipe/lang/Java.c @@ -7,8 +7,7 @@ def_target(pl_java, "java/maven/mvn/gradle"); void pl_java_prelude () { - use_this(pl_java); - chef_allow_gsr(pl_java); + chef_prep_this (pl_java, gsr); chef_set_created_on (this, "2023-08-31"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/lang/JavaScript/Bun.c b/src/recipe/lang/JavaScript/Bun.c index 394c22f..6bcdff0 100644 --- a/src/recipe/lang/JavaScript/Bun.c +++ b/src/recipe/lang/JavaScript/Bun.c @@ -7,8 +7,7 @@ def_target(pl_js_bun, "bun"); void pl_js_bun_prelude (void) { - use_this(pl_js_bun); - chef_allow_gsr(pl_js_bun); + chef_prep_this (pl_js_bun, gsr); chef_set_created_on (this, "2024-09-29"); chef_set_last_updated (this, "2025-07-22"); diff --git a/src/recipe/lang/JavaScript/JavaScript.c b/src/recipe/lang/JavaScript/JavaScript.c index 9fd6dbf..235c17c 100644 --- a/src/recipe/lang/JavaScript/JavaScript.c +++ b/src/recipe/lang/JavaScript/JavaScript.c @@ -70,8 +70,7 @@ pl_js_group_setsrc (char *option) chsrc_set_target_group_mode (); - use_this(pl_js_group); - Source_t source = chsrc_yield_source_and_confirm (this, option); + use_this_source (pl_js_group); if (npm_exist) { diff --git a/src/recipe/lang/JavaScript/Yarn.c b/src/recipe/lang/JavaScript/Yarn.c index 8c4c1a2..62d06fc 100644 --- a/src/recipe/lang/JavaScript/Yarn.c +++ b/src/recipe/lang/JavaScript/Yarn.c @@ -7,8 +7,7 @@ def_target(pl_js_yarn, "yarn"); void pl_js_yarn_prelude (void) { - use_this(pl_js_yarn); - chef_allow_gsr(pl_js_yarn); + chef_prep_this (pl_js_yarn, gsr); chef_set_created_on (this, "2023-09-09"); chef_set_last_updated (this, "2025-07-11"); diff --git a/src/recipe/lang/JavaScript/common.h b/src/recipe/lang/JavaScript/common.h index 830d51f..ec40cca 100644 --- a/src/recipe/lang/JavaScript/common.h +++ b/src/recipe/lang/JavaScript/common.h @@ -14,8 +14,7 @@ def_target(pl_js_group, "js/javascript/node/nodejs"); void pl_js_group_prelude (void) { - use_this(pl_js_group); - chef_allow_gsr(pl_js_group); + chef_prep_this (pl_js_group, gsr); chef_set_created_on (this, "2023-09-09"); chef_set_last_updated (this, "2025-07-11"); @@ -51,8 +50,7 @@ def_target(pl_js_nodejs_binary, "__internal_use_nodejs_binary__"); void pl_js_nodejs_binary_prelude (void) { - use_this(pl_js_nodejs_binary); - chef_allow_gsr(pl_js_group); + chef_prep_this (pl_js_nodejs_binary, NOOP); chef_set_created_on (this, "2023-09-09"); chef_set_last_updated (this, "2025-07-11"); diff --git a/src/recipe/lang/JavaScript/npm.c b/src/recipe/lang/JavaScript/npm.c index 93d5b8e..d40477b 100644 --- a/src/recipe/lang/JavaScript/npm.c +++ b/src/recipe/lang/JavaScript/npm.c @@ -7,8 +7,7 @@ def_target(pl_js_npm, "npm"); void pl_js_npm_prelude (void) { - use_this(pl_js_npm); - chef_allow_gsr(pl_js_npm); + chef_prep_this (pl_js_npm, gsr); chef_set_created_on (this, "2023-08-30"); chef_set_last_updated (this, "2025-07-11"); diff --git a/src/recipe/lang/JavaScript/nvm.c b/src/recipe/lang/JavaScript/nvm.c index 9586f38..5ae2206 100644 --- a/src/recipe/lang/JavaScript/nvm.c +++ b/src/recipe/lang/JavaScript/nvm.c @@ -7,8 +7,7 @@ def_target(pl_js_nvm, "nvm"); void pl_js_nvm_prelude (void) { - use_this(pl_js_nvm); - chef_allow_gsr(pl_js_nvm); + chef_prep_this (pl_js_nvm, gsr); chef_set_created_on (this, "2024-09-23"); chef_set_last_updated (this, "2025-06-19"); diff --git a/src/recipe/lang/JavaScript/pnpm.c b/src/recipe/lang/JavaScript/pnpm.c index bba23aa..847b1d9 100644 --- a/src/recipe/lang/JavaScript/pnpm.c +++ b/src/recipe/lang/JavaScript/pnpm.c @@ -7,8 +7,7 @@ def_target(pl_js_pnpm, "pnpm"); void pl_js_pnpm_prelude (void) { - use_this(pl_js_pnpm); - chef_allow_gsr(pl_js_pnpm); + chef_prep_this (pl_js_pnpm, gsr); chef_set_created_on (this, "2024-04-18"); chef_set_last_updated (this, "2025-07-11"); diff --git a/src/recipe/lang/Julia.c b/src/recipe/lang/Julia.c index 2e6374b..539e6af 100644 --- a/src/recipe/lang/Julia.c +++ b/src/recipe/lang/Julia.c @@ -7,8 +7,7 @@ def_target(pl_julia, "julia"); void pl_julia_prelude () { - use_this(pl_julia); - chef_allow_gs(pl_julia); + chef_prep_this (pl_julia, gs); chef_set_created_on (this, "2023-08-31"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/lang/Lua.c b/src/recipe/lang/Lua.c index e116e76..7f943d4 100644 --- a/src/recipe/lang/Lua.c +++ b/src/recipe/lang/Lua.c @@ -14,8 +14,7 @@ def_target(pl_lua, "lua/luarocks"); void pl_lua_prelude () { - use_this(pl_lua); - chef_allow_gs(pl_lua); + chef_prep_this (pl_lua, gs); chef_set_created_on (this, "2023-09-27"); chef_set_last_updated (this, "2025-08-10"); @@ -49,8 +48,7 @@ pl_lua_getsrc (char *option) void pl_lua_setsrc (char *option) { - use_this(pl_lua); - Source_t source = chsrc_yield_source_and_confirm (this, option); + use_this_source (pl_lua); char *config = xy_strcat (3, "rocks_servers = {\n" " \"", source.url, "\"\n" diff --git a/src/recipe/lang/NuGet.c b/src/recipe/lang/NuGet.c index 68b574c..c67a725 100644 --- a/src/recipe/lang/NuGet.c +++ b/src/recipe/lang/NuGet.c @@ -7,8 +7,7 @@ def_target(pl_nuget, "nuget/net/.net/dotnet"); void pl_nuget_prelude () { - use_this(pl_nuget); - chef_allow_gs(pl_nuget); + chef_prep_this (pl_nuget, gs); chef_set_created_on (this, "2023-09-10"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/lang/OCaml.c b/src/recipe/lang/OCaml.c index f57344c..6da10ba 100644 --- a/src/recipe/lang/OCaml.c +++ b/src/recipe/lang/OCaml.c @@ -7,8 +7,7 @@ def_target(pl_ocaml, "ocaml/opam"); void pl_ocaml_prelude () { - use_this(pl_ocaml); - chef_allow_gs(pl_ocaml); + chef_prep_this (pl_ocaml, gs); chef_set_created_on (this, "2023-09-15"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/lang/PHP.c b/src/recipe/lang/PHP.c index 1805362..339b8a2 100644 --- a/src/recipe/lang/PHP.c +++ b/src/recipe/lang/PHP.c @@ -7,8 +7,7 @@ def_target(pl_php, "php/composer"); void pl_php_prelude () { - use_this(pl_php); - chef_allow_gs(pl_php); + chef_prep_this (pl_php, gs); chef_set_created_on (this, "2023-08-30"); chef_set_last_updated (this, "2025-08-10"); @@ -56,8 +55,7 @@ pl_php_setsrc (char *option) { pl_php_check_cmd (); - use_this(pl_php); - Source_t source = chsrc_yield_source_and_confirm (this, option); + use_this_source (pl_php); char *where = " -g "; if (chsrc_in_local_mode()) diff --git a/src/recipe/lang/Perl.c b/src/recipe/lang/Perl.c index c7d6cbd..efbb7a2 100644 --- a/src/recipe/lang/Perl.c +++ b/src/recipe/lang/Perl.c @@ -7,8 +7,7 @@ def_target(pl_perl, "perl/cpan"); void pl_perl_prelude () { - use_this(pl_perl); - chef_allow_gs(pl_perl); + chef_prep_this (pl_perl, gs); chef_set_created_on (this, "2023-09-31"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/lang/Python/PDM.c b/src/recipe/lang/Python/PDM.c index bc35f74..44fc6ff 100644 --- a/src/recipe/lang/Python/PDM.c +++ b/src/recipe/lang/Python/PDM.c @@ -7,8 +7,7 @@ def_target(pl_python_pdm, "pdm"); void pl_python_pdm_prelude (void) { - use_this(pl_python_pdm); - chef_allow_gsr(pl_python_pdm); + chef_prep_this (pl_python_pdm, gsr); chef_set_created_on (this, "2024-06-05"); chef_set_last_updated (this, "2025-07-11"); @@ -22,9 +21,6 @@ pl_python_pdm_prelude (void) chef_allow_english(this); chef_allow_user_define(this); - // 使用 pl_python_group 的源 - this->sources = pl_python_group_target.sources; - this->sources_n = pl_python_group_target.sources_n; } diff --git a/src/recipe/lang/Python/Poetry.c b/src/recipe/lang/Python/Poetry.c index b9c4412..7d2008b 100644 --- a/src/recipe/lang/Python/Poetry.c +++ b/src/recipe/lang/Python/Poetry.c @@ -7,8 +7,7 @@ def_target(pl_python_poetry, "poetry"); void pl_python_poetry_prelude (void) { - use_this(pl_python_poetry); - chef_allow_gsr(pl_python_poetry); + chef_prep_this (pl_python_poetry, gsr); chef_set_created_on (this, "2024-08-08"); chef_set_last_updated (this, "2025-07-11"); diff --git a/src/recipe/lang/Python/Python.c b/src/recipe/lang/Python/Python.c index 6a4b439..0e4b4e5 100644 --- a/src/recipe/lang/Python/Python.c +++ b/src/recipe/lang/Python/Python.c @@ -58,8 +58,7 @@ pl_python_group_setsrc (char *option) chsrc_set_target_group_mode (); - use_this(pl_python_group); - Source_t source = chsrc_yield_source_and_confirm (this, option); + use_this_source (pl_python_group); // 交给后面检查命令的存在性 diff --git a/src/recipe/lang/Python/Rye.c b/src/recipe/lang/Python/Rye.c index 9bc258a..d1472e2 100644 --- a/src/recipe/lang/Python/Rye.c +++ b/src/recipe/lang/Python/Rye.c @@ -9,8 +9,7 @@ def_target(pl_python_rye, "rye"); void pl_python_rye_prelude (void) { - use_this(pl_python_rye); - chef_allow_gsr(pl_python_rye); + chef_prep_this (pl_python_rye, gsr); chef_set_created_on (this, "2024-12-06"); chef_set_last_updated (this, "2025-08-09"); diff --git a/src/recipe/lang/Python/common.h b/src/recipe/lang/Python/common.h index bdb2641..5cbf712 100644 --- a/src/recipe/lang/Python/common.h +++ b/src/recipe/lang/Python/common.h @@ -22,8 +22,7 @@ pl_python_speed_url_constructor (const char *url, const char *user_data) void pl_python_group_prelude (void) { - use_this(pl_python_group); - chef_allow_gsr(pl_python_group); + chef_prep_this (pl_python_group, gsr); chef_set_created_on (this, "2023-09-03"); chef_set_last_updated (this, "2025-07-14"); @@ -73,7 +72,7 @@ pl_python_check_unofficial_pkger (bool *poetry_exist, bool *pdm_exist, bool *uv_ /** - * @param[out] prog 返回 Python 的可用名,如果不可用,则返回 NULL + * @param[out] prog_name 返回 Python 的可用名,如果不可用,则返回 NULL */ void pl_python_get_py_program_name (char **prog_name) diff --git a/src/recipe/lang/Python/pip.c b/src/recipe/lang/Python/pip.c index bda3465..318f712 100644 --- a/src/recipe/lang/Python/pip.c +++ b/src/recipe/lang/Python/pip.c @@ -7,8 +7,7 @@ def_target(pl_python_pip, "pip"); void pl_python_pip_prelude (void) { - use_this(pl_python_pip); - chef_allow_gsr(pl_python_pip); + chef_prep_this (pl_python_pip, gsr); chef_set_created_on (this, "2023-09-03"); chef_set_last_updated (this, "2025-07-11"); diff --git a/src/recipe/lang/Python/uv.c b/src/recipe/lang/Python/uv.c index e81fb3b..f2f89e8 100644 --- a/src/recipe/lang/Python/uv.c +++ b/src/recipe/lang/Python/uv.c @@ -7,8 +7,7 @@ def_target(pl_python_uv, "uv"); void pl_python_uv_prelude (void) { - use_this(pl_python_uv); - chef_allow_gsr(pl_python_uv); + chef_prep_this (pl_python_uv, gsr); chef_set_created_on (this, "2024-12-11"); chef_set_last_updated (this, "2025-08-09"); diff --git a/src/recipe/lang/R.c b/src/recipe/lang/R.c index 0530a56..f6d625d 100644 --- a/src/recipe/lang/R.c +++ b/src/recipe/lang/R.c @@ -7,8 +7,7 @@ def_target(pl_r, "r/cran"); void pl_r_prelude () { - use_this(pl_r); - chef_allow_gs(pl_r); + chef_prep_this (pl_r, gs); chef_set_created_on (this, "2023-09-21"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/lang/Ruby/Ruby.c b/src/recipe/lang/Ruby/Ruby.c index aa6033a..065e025 100644 --- a/src/recipe/lang/Ruby/Ruby.c +++ b/src/recipe/lang/Ruby/Ruby.c @@ -14,8 +14,7 @@ def_target(pl_ruby, "gem/ruby/rb/rubygem/rubygems/bundler"); void pl_ruby_prelude (void) { - use_this(pl_ruby); - chef_allow_gsr(pl_ruby); + chef_prep_this (pl_ruby, gsr); chef_set_created_on (this, "2023-08-29"); chef_set_last_updated (this, "2025-08-11"); diff --git a/src/recipe/lang/Rust/Cargo.c b/src/recipe/lang/Rust/Cargo.c index 3a074a4..68afe0a 100644 --- a/src/recipe/lang/Rust/Cargo.c +++ b/src/recipe/lang/Rust/Cargo.c @@ -7,8 +7,7 @@ def_target(pl_rust_cargo, "rust/cargo/crate/crates"); void pl_rust_cargo_prelude (void) { - use_this(pl_rust_cargo); - chef_allow_gsr(pl_rust_cargo); + chef_prep_this (pl_rust_cargo, gsr); chef_set_created_on (this, "2023-08-30"); chef_set_last_updated (this, "2025-07-22"); diff --git a/src/recipe/lang/Rust/rustup.c b/src/recipe/lang/Rust/rustup.c index a81a75b..bebb773 100644 --- a/src/recipe/lang/Rust/rustup.c +++ b/src/recipe/lang/Rust/rustup.c @@ -10,8 +10,7 @@ def_target(pl_rust_rustup, "rustup"); void pl_rust_rustup_prelude (void) { - use_this(pl_rust_rustup); - chef_allow_gsr(pl_rust_rustup); + chef_prep_this (pl_rust_rustup, gsr); chef_set_created_on (this, "2024-10-02"); chef_set_last_updated (this, "2025-08-07"); diff --git a/src/recipe/os/APT/Armbian.c b/src/recipe/os/APT/Armbian.c index f0728e8..573022b 100644 --- a/src/recipe/os/APT/Armbian.c +++ b/src/recipe/os/APT/Armbian.c @@ -7,8 +7,7 @@ def_target(os_armbian, "armbian"); void os_armbian_prelude () { - use_this(os_armbian); - chef_allow_gsr(os_armbian); + chef_prep_this (os_armbian, gsr); chef_set_created_on (this, "2024-06-14"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/APT/Debian.c b/src/recipe/os/APT/Debian.c index 6a998f0..8a8ebcc 100644 --- a/src/recipe/os/APT/Debian.c +++ b/src/recipe/os/APT/Debian.c @@ -7,8 +7,7 @@ def_target(os_debian, "debian"); void os_debian_prelude () { - use_this(os_debian); - chef_allow_gsr(os_debian); + chef_prep_this (os_debian, gsr); chef_set_created_on (this, "2023-09-02"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/APT/Kali-Linux.c b/src/recipe/os/APT/Kali-Linux.c index 9b5232e..15a0e14 100644 --- a/src/recipe/os/APT/Kali-Linux.c +++ b/src/recipe/os/APT/Kali-Linux.c @@ -7,8 +7,7 @@ def_target(os_kali, "kali"); void os_kali_prelude () { - use_this(os_kali); - chef_allow_gsr(os_kali); + chef_prep_this (os_kali, gsr); chef_set_created_on (this, "2023-09-29"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/APT/Linux-Lite.c b/src/recipe/os/APT/Linux-Lite.c index 857cfa8..997992c 100644 --- a/src/recipe/os/APT/Linux-Lite.c +++ b/src/recipe/os/APT/Linux-Lite.c @@ -7,8 +7,7 @@ def_target(os_linuxlite, "linuxlite"); void os_linuxlite_prelude () { - use_this(os_linuxlite); - chef_allow_gsr(os_linuxlite); + chef_prep_this (os_linuxlite, gsr); chef_set_created_on (this, "2023-09-29"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/APT/Linux-Mint.c b/src/recipe/os/APT/Linux-Mint.c index a012c51..6f51882 100644 --- a/src/recipe/os/APT/Linux-Mint.c +++ b/src/recipe/os/APT/Linux-Mint.c @@ -7,8 +7,7 @@ def_target(os_linuxmint, "linuxmint"); void os_linuxmint_prelude () { - use_this(os_linuxmint); - chef_allow_gs(os_linuxmint); + chef_prep_this (os_linuxmint, gs); chef_set_created_on (this, "2023-09-29"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/APT/ROS.c b/src/recipe/os/APT/ROS.c index df1cdc9..618d247 100644 --- a/src/recipe/os/APT/ROS.c +++ b/src/recipe/os/APT/ROS.c @@ -7,8 +7,7 @@ def_target(os_ros, "ros/ros2"); void os_ros_prelude () { - use_this(os_ros); - chef_allow_gs(os_ros); + chef_prep_this (os_ros, gs); chef_set_created_on (this, "2023-09-03"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/APT/Raspberry-Pi-OS.c b/src/recipe/os/APT/Raspberry-Pi-OS.c index 1e38150..c52cb49 100644 --- a/src/recipe/os/APT/Raspberry-Pi-OS.c +++ b/src/recipe/os/APT/Raspberry-Pi-OS.c @@ -9,8 +9,7 @@ def_target(os_raspberrypi, "raspi/raspberrypi"); void os_raspberrypi_prelude () { - use_this(os_raspberrypi); - chef_allow_gsr(os_raspberrypi); + chef_prep_this (os_raspberrypi, gsr); chef_set_created_on (this, "2023-09-29"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/APT/Termux.c b/src/recipe/os/APT/Termux.c index 08dd935..bdceded 100644 --- a/src/recipe/os/APT/Termux.c +++ b/src/recipe/os/APT/Termux.c @@ -7,8 +7,7 @@ def_target(os_termux, "termux"); void os_termux_prelude () { - use_this(os_termux); - chef_allow_gsr(os_termux); + chef_prep_this (os_termux, gsr); chef_set_created_on (this, "2025-03-04"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/APT/Trisquel.c b/src/recipe/os/APT/Trisquel.c index 935ba60..c162724 100644 --- a/src/recipe/os/APT/Trisquel.c +++ b/src/recipe/os/APT/Trisquel.c @@ -9,8 +9,7 @@ def_target(os_trisquel, "trisquel"); void os_trisquel_prelude () { - use_this(os_trisquel); - chef_allow_gsr(os_trisquel); + chef_prep_this (os_trisquel, gsr); chef_set_created_on (this, "2023-09-29"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/APT/Ubuntu.c b/src/recipe/os/APT/Ubuntu.c index 8895d6f..92f5400 100644 --- a/src/recipe/os/APT/Ubuntu.c +++ b/src/recipe/os/APT/Ubuntu.c @@ -8,8 +8,7 @@ def_target(os_ubuntu, "ubuntu/zorinos"); void os_ubuntu_prelude () { - use_this(os_ubuntu); - chef_allow_gsr(os_ubuntu); + chef_prep_this (os_ubuntu, gsr); chef_set_created_on (this, "2023-08-30"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/APT/deepin.c b/src/recipe/os/APT/deepin.c index 95da89e..ab094d4 100644 --- a/src/recipe/os/APT/deepin.c +++ b/src/recipe/os/APT/deepin.c @@ -7,8 +7,7 @@ def_target(os_deepin, "deepin"); void os_deepin_prelude () { - use_this(os_deepin); - chef_allow_gsr(os_deepin); + chef_prep_this (os_deepin, gsr); chef_set_created_on (this, "2023-09-26"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/APT/openKylin.c b/src/recipe/os/APT/openKylin.c index 742669b..625d1f0 100644 --- a/src/recipe/os/APT/openKylin.c +++ b/src/recipe/os/APT/openKylin.c @@ -10,8 +10,7 @@ def_target(os_openkylin, "openkylin"); void os_openkylin_prelude () { - use_this(os_openkylin); - chef_allow_gsr(os_openkylin); + chef_prep_this (os_openkylin, gsr); chef_set_created_on (this, "2023-09-06"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/Alpine-Linux.c b/src/recipe/os/Alpine-Linux.c index 82ac21d..657a76c 100644 --- a/src/recipe/os/Alpine-Linux.c +++ b/src/recipe/os/Alpine-Linux.c @@ -7,8 +7,7 @@ def_target(os_alpine, "alpine"); void os_alpine_prelude () { - use_this(os_alpine); - chef_allow_gs(os_alpine); + chef_prep_this (os_alpine, gs); chef_set_created_on (this, "2023-09-24"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/BSD/FreeBSD.c b/src/recipe/os/BSD/FreeBSD.c index d30f9ac..cffcf0d 100644 --- a/src/recipe/os/BSD/FreeBSD.c +++ b/src/recipe/os/BSD/FreeBSD.c @@ -7,8 +7,7 @@ def_target(os_freebsd, "freebsd"); void os_freebsd_prelude () { - use_this(os_freebsd); - chef_allow_s(os_freebsd); + chef_prep_this (os_freebsd, s); chef_set_created_on (this, "2023-09-03"); chef_set_last_updated (this, "2025-08-10"); @@ -47,7 +46,7 @@ os_freebsd_setsrc (char *option) // 据 @ykla,FreeBSD不自带sudo,但是我们依然要保证是root权限 chsrc_ensure_root (); - use_this(os_freebsd); + use_this (os_freebsd); int index = use_specific_mirror_or_auto_select (option, this); Source_t source = this->sources[index]; diff --git a/src/recipe/os/BSD/NetBSD.c b/src/recipe/os/BSD/NetBSD.c index 3e7a4d1..d5daacf 100644 --- a/src/recipe/os/BSD/NetBSD.c +++ b/src/recipe/os/BSD/NetBSD.c @@ -7,8 +7,7 @@ def_target(os_netbsd, "netbsd"); void os_netbsd_prelude () { - use_this(os_netbsd); - chef_allow_gs(os_netbsd); + chef_prep_this (os_netbsd, gs); chef_set_created_on (this, "2023-09-05"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/BSD/OpenBSD.c b/src/recipe/os/BSD/OpenBSD.c index 5551e26..2e5afce 100644 --- a/src/recipe/os/BSD/OpenBSD.c +++ b/src/recipe/os/BSD/OpenBSD.c @@ -7,8 +7,7 @@ def_target(os_openbsd, "openbsd"); void os_openbsd_prelude () { - use_this(os_openbsd); - chef_allow_gs(os_openbsd); + chef_prep_this (os_openbsd, gs); chef_set_created_on (this, "2023-09-03"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/Gentoo-Linux.c b/src/recipe/os/Gentoo-Linux.c index 6330cbe..7cd56ac 100644 --- a/src/recipe/os/Gentoo-Linux.c +++ b/src/recipe/os/Gentoo-Linux.c @@ -7,8 +7,7 @@ def_target(os_gentoo, "gentoo"); void os_gentoo_prelude () { - use_this(os_gentoo); - chef_allow_s(os_gentoo); + chef_prep_this (os_gentoo, s); chef_set_created_on (this, "2023-09-05"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/OpenWrt.c b/src/recipe/os/OpenWrt.c index 71bb642..5b5efa7 100644 --- a/src/recipe/os/OpenWrt.c +++ b/src/recipe/os/OpenWrt.c @@ -7,8 +7,7 @@ def_target(os_openwrt, "openwrt/opkg/LEDE"); void os_openwrt_prelude () { - use_this(os_openwrt); - chef_allow_gsr(os_openwrt); + chef_prep_this (os_openwrt, gsr); chef_set_created_on (this, "2024-08-08"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/Solus.c b/src/recipe/os/Solus.c index 6542b6f..966e83f 100644 --- a/src/recipe/os/Solus.c +++ b/src/recipe/os/Solus.c @@ -7,8 +7,7 @@ def_target(os_solus, "solus"); void os_solus_prelude () { - use_this(os_solus); - chef_allow_s(os_solus); + chef_prep_this (os_solus, s); chef_set_created_on (this, "2023-09-29"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/Void-Linux.c b/src/recipe/os/Void-Linux.c index ba500af..6f17aec 100644 --- a/src/recipe/os/Void-Linux.c +++ b/src/recipe/os/Void-Linux.c @@ -7,8 +7,7 @@ def_target(os_voidlinux, "voidlinux"); void os_voidlinux_prelude () { - use_this(os_voidlinux); - chef_allow_gsr(os_voidlinux); + chef_prep_this (os_voidlinux, gsr); chef_set_created_on (this, "2023-09-24"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/YUM/AlmaLinux.c b/src/recipe/os/YUM/AlmaLinux.c index ffe950f..5e709d5 100644 --- a/src/recipe/os/YUM/AlmaLinux.c +++ b/src/recipe/os/YUM/AlmaLinux.c @@ -7,8 +7,7 @@ def_target(os_almalinux, "alma/almalinux"); void os_almalinux_prelude () { - use_this(os_almalinux); - chef_allow_s(os_almalinux); + chef_prep_this (os_almalinux, s); chef_set_created_on (this, "2024-06-12"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/YUM/Anolis-OS.c b/src/recipe/os/YUM/Anolis-OS.c index fe71399..4127f9c 100644 --- a/src/recipe/os/YUM/Anolis-OS.c +++ b/src/recipe/os/YUM/Anolis-OS.c @@ -7,8 +7,7 @@ def_target(os_anolis, "anolis/openanolis"); void os_anolis_prelude () { - use_this(os_anolis); - chef_allow_s(os_anolis); + chef_prep_this (os_anolis, s); chef_set_created_on (this, "2023-09-24"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/YUM/Fedora-Linux.c b/src/recipe/os/YUM/Fedora-Linux.c index 999b0df..1b744d4 100644 --- a/src/recipe/os/YUM/Fedora-Linux.c +++ b/src/recipe/os/YUM/Fedora-Linux.c @@ -7,8 +7,7 @@ def_target(os_fedora, "fedora"); void os_fedora_prelude () { - use_this(os_fedora); - chef_allow_sr(os_fedora); + chef_prep_this (os_fedora, sr); chef_set_created_on (this, "2023-09-26"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/YUM/Rocky-Linux.c b/src/recipe/os/YUM/Rocky-Linux.c index 33d165a..051047b 100644 --- a/src/recipe/os/YUM/Rocky-Linux.c +++ b/src/recipe/os/YUM/Rocky-Linux.c @@ -7,8 +7,7 @@ def_target(os_rockylinux, "rocky/rockylinux"); void os_rockylinux_prelude () { - use_this(os_rockylinux); - chef_allow_sr(os_rockylinux); + chef_prep_this (os_rockylinux, sr); chef_set_created_on (this, "2023-09-24"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/YUM/openEuler.c b/src/recipe/os/YUM/openEuler.c index 97c3db8..47f68b1 100644 --- a/src/recipe/os/YUM/openEuler.c +++ b/src/recipe/os/YUM/openEuler.c @@ -7,8 +7,7 @@ def_target(os_openeuler, "openeuler"); void os_openeuler_prelude () { - use_this(os_openeuler); - chef_allow_gs(os_openeuler); + chef_prep_this (os_openeuler, gs); chef_set_created_on (this, "2023-09-06"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/openSUSE.c b/src/recipe/os/openSUSE.c index 0f29fb0..8a3cb38 100644 --- a/src/recipe/os/openSUSE.c +++ b/src/recipe/os/openSUSE.c @@ -7,8 +7,7 @@ def_target(os_opensuse, "opensuse/opensuse-leap/opensuse-tumbleweed"); void os_opensuse_prelude () { - use_this(os_opensuse); - chef_allow_s(os_opensuse); + chef_prep_this (os_opensuse, s); chef_set_created_on (this, "2023-09-17"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/pacman/Arch-Linux.c b/src/recipe/os/pacman/Arch-Linux.c index 5d4a791..af01323 100644 --- a/src/recipe/os/pacman/Arch-Linux.c +++ b/src/recipe/os/pacman/Arch-Linux.c @@ -10,8 +10,7 @@ def_target(os_arch, "arch/archlinux"); void os_arch_prelude () { - use_this(os_arch); - chef_allow_gs(os_arch); + chef_prep_this (os_arch, gs); chef_set_created_on (this, "2023-09-05"); chef_set_last_updated (this, "2025-08-10"); @@ -113,8 +112,7 @@ def_target(os_archlinuxcn, "archlinuxcn/archcn"); void os_archlinuxcn_prelude () { - use_this(os_archlinuxcn); - chef_allow_gs(os_archlinuxcn); + chef_prep_this (os_archlinuxcn, gs); chef_set_created_on (this, "2023-09-05"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/pacman/MSYS2.c b/src/recipe/os/pacman/MSYS2.c index 5a2f245..08dcfa0 100644 --- a/src/recipe/os/pacman/MSYS2.c +++ b/src/recipe/os/pacman/MSYS2.c @@ -7,8 +7,7 @@ def_target(os_msys2, "msys2/msys"); void os_msys2_prelude () { - use_this(os_msys2); - chef_allow_s(os_msys2); + chef_prep_this (os_msys2, s); chef_set_created_on (this, "2023-09-06"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/os/pacman/Manjaro-Linux.c b/src/recipe/os/pacman/Manjaro-Linux.c index 2e918f2..a1731fe 100644 --- a/src/recipe/os/pacman/Manjaro-Linux.c +++ b/src/recipe/os/pacman/Manjaro-Linux.c @@ -7,8 +7,7 @@ def_target(os_manjaro, "manjaro"); void os_manjaro_prelude () { - use_this(os_manjaro); - chef_allow_s(os_manjaro); + chef_prep_this (os_manjaro, s); chef_set_created_on (this, "2023-09-06"); chef_set_last_updated (this, "2025-08-10"); diff --git a/src/recipe/ware/Anaconda/Anaconda.c b/src/recipe/ware/Anaconda/Anaconda.c index baca25d..8536d92 100644 --- a/src/recipe/ware/Anaconda/Anaconda.c +++ b/src/recipe/ware/Anaconda/Anaconda.c @@ -9,8 +9,7 @@ def_target(wr_anaconda, "conda/anaconda"); void wr_anaconda_prelude () { - use_this(wr_anaconda); - chef_allow_gs(wr_anaconda); + chef_prep_this (wr_anaconda, gs); chef_set_created_on (this, "2023-09-10"); chef_set_last_updated (this, "2025-08-09"); diff --git a/src/recipe/ware/CocoaPods.c b/src/recipe/ware/CocoaPods.c index abe815a..78a4aed 100644 --- a/src/recipe/ware/CocoaPods.c +++ b/src/recipe/ware/CocoaPods.c @@ -7,8 +7,7 @@ def_target(wr_cocoapods, "cocoa/cocoapods/cocoapod"); void wr_cocoapods_prelude () { - use_this(wr_cocoapods); - chef_allow_s(wr_cocoapods); + chef_prep_this (wr_cocoapods, s); chef_set_created_on (this, "2024-06-08"); chef_set_last_updated (this, "2025-08-09"); diff --git a/src/recipe/ware/Docker/Docker.c b/src/recipe/ware/Docker/Docker.c index 7404153..8c9ebc2 100644 --- a/src/recipe/ware/Docker/Docker.c +++ b/src/recipe/ware/Docker/Docker.c @@ -24,8 +24,7 @@ def_target(wr_docker, "docker/dockerhub"); void wr_docker_prelude () { - use_this(wr_docker); - chef_allow_gs(wr_docker); + chef_prep_this (wr_docker, gs); chef_set_created_on (this, "2024-06-08"); chef_set_last_updated (this, "2025-08-09"); diff --git a/src/recipe/ware/Emacs.c b/src/recipe/ware/Emacs.c index 0c97887..1e8663a 100644 --- a/src/recipe/ware/Emacs.c +++ b/src/recipe/ware/Emacs.c @@ -14,8 +14,7 @@ def_target(wr_emacs, "emacs/elpa"); void wr_emacs_prelude () { - use_this(wr_emacs); - chef_allow_s(wr_emacs); + chef_prep_this (wr_emacs, s); chef_set_created_on (this, "2023-10-10"); chef_set_last_updated (this, "2025-08-09"); diff --git a/src/recipe/ware/Flatpak.c b/src/recipe/ware/Flatpak.c index 572c523..47d06c7 100644 --- a/src/recipe/ware/Flatpak.c +++ b/src/recipe/ware/Flatpak.c @@ -7,8 +7,7 @@ def_target(wr_flatpak, "flatpak/flathub"); void wr_flatpak_prelude () { - use_this(wr_flatpak); - chef_allow_gsr(wr_flatpak); + chef_prep_this (wr_flatpak, gsr); chef_set_created_on (this, "2023-09-11"); chef_set_last_updated (this, "2025-08-09"); diff --git a/src/recipe/ware/Guix.c b/src/recipe/ware/Guix.c index 2c74c13..5b39725 100644 --- a/src/recipe/ware/Guix.c +++ b/src/recipe/ware/Guix.c @@ -7,8 +7,7 @@ def_target(wr_guix, "guix"); void wr_guix_prelude () { - use_this(wr_guix); - chef_allow_s(wr_guix); + chef_prep_this (wr_guix, s); chef_set_created_on (this, "2023-09-11"); chef_set_last_updated (this, "2025-08-09"); diff --git a/src/recipe/ware/Homebrew/Homebrew.c b/src/recipe/ware/Homebrew/Homebrew.c index 9e206ad..baf2ea6 100644 --- a/src/recipe/ware/Homebrew/Homebrew.c +++ b/src/recipe/ware/Homebrew/Homebrew.c @@ -9,8 +9,7 @@ def_target(wr_homebrew, "brew/homebrew"); void wr_homebrew_prelude () { - use_this(wr_homebrew); - chef_allow_gs(wr_homebrew); + chef_prep_this (wr_homebrew, gs); chef_set_created_on (this, "2023-09-10"); chef_set_last_updated (this, "2025-08-09"); diff --git a/src/recipe/ware/Nix.c b/src/recipe/ware/Nix.c index 8504716..72b8756 100644 --- a/src/recipe/ware/Nix.c +++ b/src/recipe/ware/Nix.c @@ -7,8 +7,7 @@ def_target(wr_nix, "nix"); void wr_nix_prelude () { - use_this(wr_nix); - chef_allow_s(wr_nix); + chef_prep_this (wr_nix, s); chef_set_created_on (this, "2023-09-26"); chef_set_last_updated (this, "2025-08-09"); diff --git a/src/recipe/ware/TeX-Live.c b/src/recipe/ware/TeX-Live.c index 9de3455..10d89f1 100644 --- a/src/recipe/ware/TeX-Live.c +++ b/src/recipe/ware/TeX-Live.c @@ -9,8 +9,7 @@ def_target(wr_tex, "latex/ctan/tex/texlive/miktex/tlmgr/mpm"); void wr_tex_prelude () { - use_this(wr_tex); - chef_allow_gs(wr_tex); + chef_prep_this (wr_tex, gs); chef_set_created_on (this, "2023-09-10"); chef_set_last_updated (this, "2025-08-09"); diff --git a/src/recipe/ware/WinGet.c b/src/recipe/ware/WinGet.c index 70384f8..2bd3265 100644 --- a/src/recipe/ware/WinGet.c +++ b/src/recipe/ware/WinGet.c @@ -7,8 +7,7 @@ def_target(wr_winget, "winget"); void wr_winget_prelude () { - use_this(wr_winget); - chef_allow_gsr(wr_winget); + chef_prep_this (wr_winget, gsr); chef_set_created_on (this, "2024-06-07"); chef_set_last_updated (this, "2025-08-17"); From 106cb97e08c5e503d8d6972212b3fd28514a77b4 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 13:11:45 +0800 Subject: [PATCH 086/103] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20`chef=5Fuse=5Fothe?= =?UTF-8?q?r=5Ftarget=5Fsources()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/chef.c | 12 ++++++++++++ src/recipe/lang/Python/PDM.c | 1 + 2 files changed, 13 insertions(+) diff --git a/src/framework/chef.c b/src/framework/chef.c index 16e4956..b191797 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -101,6 +101,18 @@ chef_set_sources_speed_measure_url_with_postfix (Target_t *target, char *postfix } +/** + * @note 用于: 组中的 item target 在 standalone 模式时正确填充源信息 + */ +void +chef_use_other_target_sources (Target_t *this, Target_t *other) +{ + if (!other->inited) other->preludefn(); + this->sources = other->sources; + this->sources_n = other->sources_n; +} + + void chef_allow_english (Target_t *target) { diff --git a/src/recipe/lang/Python/PDM.c b/src/recipe/lang/Python/PDM.c index 44fc6ff..1cb7396 100644 --- a/src/recipe/lang/Python/PDM.c +++ b/src/recipe/lang/Python/PDM.c @@ -21,6 +21,7 @@ pl_python_pdm_prelude (void) chef_allow_english(this); chef_allow_user_define(this); + chef_use_other_target_sources (this, &pl_python_group_target); } From 8130f11cd1b9297b859dad4e9ae92a00d03b2465 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 13:38:41 +0800 Subject: [PATCH 087/103] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20Python=20=E5=92=8C?= =?UTF-8?q?=20JavaScript=20=E7=BB=84=E4=B8=AD=20target=20=E7=9A=84=20`ls`?= =?UTF-8?q?=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/core.c | 8 ++++++++ src/recipe/lang/JavaScript/Bun.c | 4 +--- src/recipe/lang/JavaScript/Yarn.c | 4 +--- src/recipe/lang/JavaScript/npm.c | 4 +--- src/recipe/lang/JavaScript/nvm.c | 4 +--- src/recipe/lang/JavaScript/pnpm.c | 4 +--- src/recipe/lang/Python/Poetry.c | 4 +--- src/recipe/lang/Python/Rye.c | 4 +--- src/recipe/lang/Python/pip.c | 4 +--- src/recipe/lang/Python/uv.c | 4 +--- 10 files changed, 17 insertions(+), 27 deletions(-) diff --git a/src/framework/core.c b/src/framework/core.c index d2b90b1..4c7ed0a 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -1023,6 +1023,14 @@ source_has_empty_url (Source_t *source) Source_t chsrc_yield_source (Target_t *t, char *option) { + /** + * 防止某些意外时刻 _setsrc() 等函数会被直接调,但此时 _prelude() 还没有执行过 + * 我们在这里卡一道,确保 _prelude() 被调用 + * + * 目前可能出现这种情况的时候:组换源的时候,组成菜的 _setsrc() 被直接调用 + */ + if (!t->inited) t->preludefn(); + Source_t source; if (chsrc_in_target_group_mode() && ProgStatus.leader_selected_index==-1) { diff --git a/src/recipe/lang/JavaScript/Bun.c b/src/recipe/lang/JavaScript/Bun.c index 6bcdff0..ebd8a16 100644 --- a/src/recipe/lang/JavaScript/Bun.c +++ b/src/recipe/lang/JavaScript/Bun.c @@ -21,9 +21,7 @@ pl_js_bun_prelude (void) chef_allow_english(this); chef_allow_user_define(this); - // 用的是 npm Registry 的源,所以使用 pl_js_group 的源 - this->sources = pl_js_group_target.sources; - this->sources_n = pl_js_group_target.sources_n; + chef_use_other_target_sources (this, &pl_js_group_target); } /** diff --git a/src/recipe/lang/JavaScript/Yarn.c b/src/recipe/lang/JavaScript/Yarn.c index 62d06fc..65532ae 100644 --- a/src/recipe/lang/JavaScript/Yarn.c +++ b/src/recipe/lang/JavaScript/Yarn.c @@ -21,9 +21,7 @@ pl_js_yarn_prelude (void) chef_allow_english(this); chef_allow_user_define(this); - // 使用 pl_js_group 的源 - this->sources = pl_js_group_target.sources; - this->sources_n = pl_js_group_target.sources_n; + chef_use_other_target_sources (this, &pl_js_group_target); } static double diff --git a/src/recipe/lang/JavaScript/npm.c b/src/recipe/lang/JavaScript/npm.c index d40477b..ff832e4 100644 --- a/src/recipe/lang/JavaScript/npm.c +++ b/src/recipe/lang/JavaScript/npm.c @@ -21,9 +21,7 @@ pl_js_npm_prelude (void) chef_allow_english(this); chef_allow_user_define(this); - // 使用 pl_js_group 的源 - this->sources = pl_js_group_target.sources; - this->sources_n = pl_js_group_target.sources_n; + chef_use_other_target_sources (this, &pl_js_group_target); } diff --git a/src/recipe/lang/JavaScript/nvm.c b/src/recipe/lang/JavaScript/nvm.c index 5ae2206..cc65e1b 100644 --- a/src/recipe/lang/JavaScript/nvm.c +++ b/src/recipe/lang/JavaScript/nvm.c @@ -23,9 +23,7 @@ pl_js_nvm_prelude (void) chef_set_note (this, "nvm 不支持 Fish shell", "nvm does not support Fish"); - // 使用 pl_js_nodejs_binary 的源 - this->sources = pl_js_nodejs_binary_target.sources; - this->sources_n = pl_js_nodejs_binary_target.sources_n; + chef_use_other_target_sources (this, &pl_js_nodejs_binary_target); } diff --git a/src/recipe/lang/JavaScript/pnpm.c b/src/recipe/lang/JavaScript/pnpm.c index 847b1d9..40b8694 100644 --- a/src/recipe/lang/JavaScript/pnpm.c +++ b/src/recipe/lang/JavaScript/pnpm.c @@ -21,9 +21,7 @@ pl_js_pnpm_prelude (void) chef_allow_english(this); chef_allow_user_define(this); - // 使用 pl_js_group 的源 - this->sources = pl_js_group_target.sources; - this->sources_n = pl_js_group_target.sources_n; + chef_use_other_target_sources (this, &pl_js_group_target); } diff --git a/src/recipe/lang/Python/Poetry.c b/src/recipe/lang/Python/Poetry.c index 7d2008b..24e185a 100644 --- a/src/recipe/lang/Python/Poetry.c +++ b/src/recipe/lang/Python/Poetry.c @@ -21,9 +21,7 @@ pl_python_poetry_prelude (void) chef_allow_english(this); chef_allow_user_define(this); - // 使用 pl_python_group 的源 - this->sources = pl_python_group_target.sources; - this->sources_n = pl_python_group_target.sources_n; + chef_use_other_target_sources (this, &pl_python_group_target); } void diff --git a/src/recipe/lang/Python/Rye.c b/src/recipe/lang/Python/Rye.c index d1472e2..10ea91c 100644 --- a/src/recipe/lang/Python/Rye.c +++ b/src/recipe/lang/Python/Rye.c @@ -23,9 +23,7 @@ pl_python_rye_prelude (void) chef_allow_english(this); chef_allow_user_define(this); - // 使用 pl_python_group 的源 - this->sources = pl_python_group_target.sources; - this->sources_n = pl_python_group_target.sources_n; + chef_use_other_target_sources (this, &pl_python_group_target); } char * diff --git a/src/recipe/lang/Python/pip.c b/src/recipe/lang/Python/pip.c index 318f712..b4a27f0 100644 --- a/src/recipe/lang/Python/pip.c +++ b/src/recipe/lang/Python/pip.c @@ -21,9 +21,7 @@ pl_python_pip_prelude (void) chef_allow_english(this); chef_allow_user_define(this); - // 使用 pl_python_group 的源 - this->sources = pl_python_group_target.sources; - this->sources_n = pl_python_group_target.sources_n; + chef_use_other_target_sources (this, &pl_python_group_target); } diff --git a/src/recipe/lang/Python/uv.c b/src/recipe/lang/Python/uv.c index f2f89e8..f56d9fe 100644 --- a/src/recipe/lang/Python/uv.c +++ b/src/recipe/lang/Python/uv.c @@ -21,9 +21,7 @@ pl_python_uv_prelude (void) chef_allow_english(this); chef_allow_user_define(this); - // 使用 pl_python_group 的源 - this->sources = pl_python_group_target.sources; - this->sources_n = pl_python_group_target.sources_n; + chef_use_other_target_sources (this, &pl_python_group_target); } From 6600099283ec33e2de24c818e9a639bca0573be8 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 14:34:58 +0800 Subject: [PATCH 088/103] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20contribut?= =?UTF-8?q?ors=20=E4=B8=BA=20sauciers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chsrc-main.c | 14 ++++++-------- src/framework/chef.c | 10 +++++----- src/framework/struct.h | 15 +++++++-------- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 3063aea..a6574f8 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -383,22 +383,20 @@ cli_print_target_maintain_info (Target_t *target, const char *input_target_name) } { - char *msg = ENGLISH ? "Contributors: " : "调味: "; - if (target->contributors && target->contributors_n > 0) + char *msg = ENGLISH ? "Sauciers: " : "调味: "; + if (target->sauciers && target->sauciers_n > 0) { printf ("%s", bdblue(msg)); - for (size_t i = 0; i < target->contributors_n; i++) + for (size_t i = 0; i < target->sauciers_n; i++) { if (i > 0) printf (", "); - printf ("%s <%s>", - target->contributors[i]->name ? target->contributors[i]->name : "Unknown", - target->contributors[i]->email ? target->contributors[i]->email : "unknown@example.com"); + printf ("%s <%s>", target->sauciers[i]->name, target->sauciers[i]->email ); } - printf ("\n"); + br(); } else { - char *msg1 = CHINESE ? "暂空缺, 欢迎参与贡献!" : "Vacant, Welcome to contribute!"; + char *msg1 = CHINESE ? "暂空缺, 欢迎参与贡献" : "Vacant, Welcome to contribute!"; printf ("%s%s\n", bdblue(msg), bdgreen(msg1)); } } diff --git a/src/framework/chef.c b/src/framework/chef.c index b191797..2ba5b21 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -261,21 +261,21 @@ chef_set_contributors (Target_t *target, uint32_t count, ...) if (count == 0) { - target->contributors = NULL; - target->contributors_n = 0; + target->sauciers = NULL; + target->sauciers_n = 0; return; } va_list args; va_start (args, count); - target->contributors = xy_malloc0 (count * sizeof (Contributor_t*)); - target->contributors_n = count; + target->sauciers = xy_malloc0 (count * sizeof (Contributor_t*)); + target->sauciers_n = count; for (uint32_t i = 0; i < count; i++) { char *id = va_arg (args, char*); - target->contributors[i] = chef_verify_contributor (id); + target->sauciers[i] = chef_verify_contributor (id); } } diff --git a/src/framework/struct.h b/src/framework/struct.h index ab9d123..e984893 100644 --- a/src/framework/struct.h +++ b/src/framework/struct.h @@ -2,12 +2,12 @@ * SPDX-License-Identifier: GPL-3.0-or-later * ------------------------------------------------------------- * File Name : struct.h - * File Authors : Aoran Zeng - * | Heng Guo <2085471348@qq.com> + * File Authors : 曾奥然 + * | 郭恒 <2085471348@qq.com> * Contributors : Shengwei Chen <414685209@qq.com> * | * Created On : <2023-08-29> - * Last Modified : <2025-08-20> + * Last Modified : <2025-08-22> * * chsrc struct * ------------------------------------------------------------*/ @@ -151,12 +151,11 @@ typedef struct Target_t char *last_updated; char *sources_last_updated; - Contributor_t *chef; /* 该 recipe 的负责人 */ - Contributor_t **cooks; /* 该 recipe 的核心作者 */ + Contributor_t *chef; /* 该 recipe *当前*的总负责人 (可以任职也可以休职) */ + Contributor_t **cooks; /* 该 recipe 的主要作者 */ size_t cooks_n; - - Contributor_t **contributors; /* 该 recipe 的所有贡献者(除核心作者外的其他人) */ - size_t contributors_n; + Contributor_t **sauciers; /* 该 recipe 的次要贡献者 (除主要作者外的其他人) */ + size_t sauciers_n; } Target_t; From c8818e4923cd150eb1ca1fc12c073413e9a1be67 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 14:36:55 +0800 Subject: [PATCH 089/103] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=E4=B8=BA=20?= =?UTF-8?q?`chef=5Fset=5Fsauciers()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/chef.c | 2 +- src/recipe/lang/Clojure.c | 2 +- src/recipe/lang/Dart/Flutter.c | 2 +- src/recipe/lang/Dart/Pub.c | 2 +- src/recipe/lang/Go.c | 2 +- src/recipe/lang/Haskell.c | 2 +- src/recipe/lang/Java.c | 2 +- src/recipe/lang/JavaScript/Bun.c | 2 +- src/recipe/lang/JavaScript/Yarn.c | 2 +- src/recipe/lang/JavaScript/common.h | 4 ++-- src/recipe/lang/JavaScript/npm.c | 2 +- src/recipe/lang/JavaScript/nvm.c | 2 +- src/recipe/lang/JavaScript/pnpm.c | 2 +- src/recipe/lang/Julia.c | 2 +- src/recipe/lang/Lua.c | 2 +- src/recipe/lang/NuGet.c | 2 +- src/recipe/lang/OCaml.c | 2 +- src/recipe/lang/PHP.c | 2 +- src/recipe/lang/Perl.c | 2 +- src/recipe/lang/Python/PDM.c | 2 +- src/recipe/lang/Python/Poetry.c | 2 +- src/recipe/lang/Python/Rye.c | 2 +- src/recipe/lang/Python/common.h | 2 +- src/recipe/lang/Python/pip.c | 2 +- src/recipe/lang/Python/uv.c | 2 +- src/recipe/lang/R.c | 2 +- src/recipe/lang/Ruby/Ruby.c | 2 +- src/recipe/lang/Rust/Cargo.c | 2 +- src/recipe/lang/Rust/rustup.c | 2 +- src/recipe/os/APT/Armbian.c | 2 +- src/recipe/os/APT/Debian.c | 2 +- src/recipe/os/APT/Kali-Linux.c | 2 +- src/recipe/os/APT/Linux-Lite.c | 2 +- src/recipe/os/APT/Linux-Mint.c | 2 +- src/recipe/os/APT/ROS.c | 2 +- src/recipe/os/APT/Raspberry-Pi-OS.c | 2 +- src/recipe/os/APT/Termux.c | 2 +- src/recipe/os/APT/Trisquel.c | 2 +- src/recipe/os/APT/Ubuntu.c | 2 +- src/recipe/os/APT/deepin.c | 2 +- src/recipe/os/APT/openKylin.c | 2 +- src/recipe/os/Alpine-Linux.c | 2 +- src/recipe/os/BSD/FreeBSD.c | 2 +- src/recipe/os/BSD/NetBSD.c | 2 +- src/recipe/os/BSD/OpenBSD.c | 2 +- src/recipe/os/Gentoo-Linux.c | 2 +- src/recipe/os/OpenWrt.c | 2 +- src/recipe/os/Solus.c | 2 +- src/recipe/os/Void-Linux.c | 2 +- src/recipe/os/YUM/AlmaLinux.c | 2 +- src/recipe/os/YUM/Anolis-OS.c | 2 +- src/recipe/os/YUM/Fedora-Linux.c | 2 +- src/recipe/os/YUM/Rocky-Linux.c | 2 +- src/recipe/os/YUM/openEuler.c | 2 +- src/recipe/os/openSUSE.c | 2 +- src/recipe/os/pacman/Arch-Linux.c | 4 ++-- src/recipe/os/pacman/MSYS2.c | 2 +- src/recipe/os/pacman/Manjaro-Linux.c | 2 +- src/recipe/recipe-template.c | 2 +- src/recipe/ware/Anaconda/Anaconda.c | 2 +- src/recipe/ware/CocoaPods.c | 2 +- src/recipe/ware/Docker/Docker.c | 2 +- src/recipe/ware/Emacs.c | 2 +- src/recipe/ware/Flatpak.c | 2 +- src/recipe/ware/Guix.c | 2 +- src/recipe/ware/Homebrew/Homebrew.c | 2 +- src/recipe/ware/Nix.c | 2 +- src/recipe/ware/TeX-Live.c | 2 +- src/recipe/ware/WinGet.c | 2 +- 69 files changed, 71 insertions(+), 71 deletions(-) diff --git a/src/framework/chef.c b/src/framework/chef.c index 2ba5b21..9268b9b 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -255,7 +255,7 @@ chef_set_cooks (Target_t *target, size_t count, ...) } void -chef_set_contributors (Target_t *target, uint32_t count, ...) +chef_set_sauciers (Target_t *target, uint32_t count, ...) { xy_cant_be_null (target); diff --git a/src/recipe/lang/Clojure.c b/src/recipe/lang/Clojure.c index 105b5c6..96eafd5 100644 --- a/src/recipe/lang/Clojure.c +++ b/src/recipe/lang/Clojure.c @@ -15,7 +15,7 @@ pl_clojure_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@hezonglun"); + chef_set_sauciers (this, 1, "@hezonglun"); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/lang/Dart/Flutter.c b/src/recipe/lang/Dart/Flutter.c index 6363bc3..895713e 100644 --- a/src/recipe/lang/Dart/Flutter.c +++ b/src/recipe/lang/Dart/Flutter.c @@ -15,7 +15,7 @@ pl_dart_flutter_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 2, "@czyt", "@xrgzs"); + chef_set_sauciers (this, 2, "@czyt", "@xrgzs"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/Dart/Pub.c b/src/recipe/lang/Dart/Pub.c index 99117e3..d0a685c 100644 --- a/src/recipe/lang/Dart/Pub.c +++ b/src/recipe/lang/Dart/Pub.c @@ -15,7 +15,7 @@ pl_dart_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 2, "@czyt", "@xrgzs"); + chef_set_sauciers (this, 2, "@czyt", "@xrgzs"); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/Go.c b/src/recipe/lang/Go.c index 7cc5edc..6d58e33 100644 --- a/src/recipe/lang/Go.c +++ b/src/recipe/lang/Go.c @@ -29,7 +29,7 @@ pl_go_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 2, "@czyt", "@techoc"); + chef_set_sauciers (this, 2, "@czyt", "@techoc"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/lang/Haskell.c b/src/recipe/lang/Haskell.c index 7231432..ad6461b 100644 --- a/src/recipe/lang/Haskell.c +++ b/src/recipe/lang/Haskell.c @@ -15,7 +15,7 @@ pl_haskell_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/lang/Java.c b/src/recipe/lang/Java.c index 548700d..4d5eadd 100644 --- a/src/recipe/lang/Java.c +++ b/src/recipe/lang/Java.c @@ -15,7 +15,7 @@ pl_java_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@BingChunMoLi"); + chef_set_sauciers (this, 1, "@BingChunMoLi"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/lang/JavaScript/Bun.c b/src/recipe/lang/JavaScript/Bun.c index ebd8a16..bf3d3a9 100644 --- a/src/recipe/lang/JavaScript/Bun.c +++ b/src/recipe/lang/JavaScript/Bun.c @@ -15,7 +15,7 @@ pl_js_bun_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@lontten"); + chef_set_sauciers (this, 1, "@lontten"); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/JavaScript/Yarn.c b/src/recipe/lang/JavaScript/Yarn.c index 65532ae..a80515f 100644 --- a/src/recipe/lang/JavaScript/Yarn.c +++ b/src/recipe/lang/JavaScript/Yarn.c @@ -15,7 +15,7 @@ pl_js_yarn_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@MrWillCom"); + chef_set_sauciers (this, 1, "@MrWillCom"); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/JavaScript/common.h b/src/recipe/lang/JavaScript/common.h index ec40cca..2ff97fd 100644 --- a/src/recipe/lang/JavaScript/common.h +++ b/src/recipe/lang/JavaScript/common.h @@ -24,7 +24,7 @@ pl_js_group_prelude (void) chef_set_chef (this, "@happy-game"); - chef_set_contributors (this,0); + chef_set_sauciers (this,0); chef_allow_local_mode (this, PartiallyCan, "支持 npm, yarn v2, pnpm, 不支持 yarn v1", @@ -58,7 +58,7 @@ pl_js_nodejs_binary_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/JavaScript/npm.c b/src/recipe/lang/JavaScript/npm.c index ff832e4..c359ddf 100644 --- a/src/recipe/lang/JavaScript/npm.c +++ b/src/recipe/lang/JavaScript/npm.c @@ -15,7 +15,7 @@ pl_js_npm_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@MrWillCom"); + chef_set_sauciers (this, 1, "@MrWillCom"); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/JavaScript/nvm.c b/src/recipe/lang/JavaScript/nvm.c index cc65e1b..91676ab 100644 --- a/src/recipe/lang/JavaScript/nvm.c +++ b/src/recipe/lang/JavaScript/nvm.c @@ -15,7 +15,7 @@ pl_js_nvm_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/JavaScript/pnpm.c b/src/recipe/lang/JavaScript/pnpm.c index 40b8694..42577ba 100644 --- a/src/recipe/lang/JavaScript/pnpm.c +++ b/src/recipe/lang/JavaScript/pnpm.c @@ -15,7 +15,7 @@ pl_js_pnpm_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/Julia.c b/src/recipe/lang/Julia.c index 539e6af..f225b57 100644 --- a/src/recipe/lang/Julia.c +++ b/src/recipe/lang/Julia.c @@ -15,7 +15,7 @@ pl_julia_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/Lua.c b/src/recipe/lang/Lua.c index 7f943d4..738689d 100644 --- a/src/recipe/lang/Lua.c +++ b/src/recipe/lang/Lua.c @@ -22,7 +22,7 @@ pl_lua_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/lang/NuGet.c b/src/recipe/lang/NuGet.c index c67a725..19b0bea 100644 --- a/src/recipe/lang/NuGet.c +++ b/src/recipe/lang/NuGet.c @@ -15,7 +15,7 @@ pl_nuget_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/lang/OCaml.c b/src/recipe/lang/OCaml.c index 6da10ba..a70cdd2 100644 --- a/src/recipe/lang/OCaml.c +++ b/src/recipe/lang/OCaml.c @@ -15,7 +15,7 @@ pl_ocaml_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/lang/PHP.c b/src/recipe/lang/PHP.c index 339b8a2..228beda 100644 --- a/src/recipe/lang/PHP.c +++ b/src/recipe/lang/PHP.c @@ -15,7 +15,7 @@ pl_php_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/lang/Perl.c b/src/recipe/lang/Perl.c index efbb7a2..f107370 100644 --- a/src/recipe/lang/Perl.c +++ b/src/recipe/lang/Perl.c @@ -15,7 +15,7 @@ pl_perl_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@hezonglun"); + chef_set_sauciers (this, 1, "@hezonglun"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/lang/Python/PDM.c b/src/recipe/lang/Python/PDM.c index 1cb7396..276298e 100644 --- a/src/recipe/lang/Python/PDM.c +++ b/src/recipe/lang/Python/PDM.c @@ -15,7 +15,7 @@ pl_python_pdm_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, FullyCan, "支持项目级配置", "Supports project-level configuration"); chef_allow_english(this); diff --git a/src/recipe/lang/Python/Poetry.c b/src/recipe/lang/Python/Poetry.c index 24e185a..02e9580 100644 --- a/src/recipe/lang/Python/Poetry.c +++ b/src/recipe/lang/Python/Poetry.c @@ -15,7 +15,7 @@ pl_python_poetry_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, FullyCan, "Poetry 默认使用项目级换源", "Poetry uses project-level source changing by default"); chef_allow_english(this); diff --git a/src/recipe/lang/Python/Rye.c b/src/recipe/lang/Python/Rye.c index 10ea91c..709809f 100644 --- a/src/recipe/lang/Python/Rye.c +++ b/src/recipe/lang/Python/Rye.c @@ -17,7 +17,7 @@ pl_python_rye_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, FullyCan, "支持项目级配置", "Supports project-level configuration"); chef_allow_english(this); diff --git a/src/recipe/lang/Python/common.h b/src/recipe/lang/Python/common.h index 5cbf712..1233e48 100644 --- a/src/recipe/lang/Python/common.h +++ b/src/recipe/lang/Python/common.h @@ -30,7 +30,7 @@ pl_python_group_prelude (void) chef_set_chef (this, "@happy-game"); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@xyx1926885268"); + chef_set_sauciers (this, 1, "@xyx1926885268"); chef_allow_local_mode (this, PartiallyCan, "部分包管理器支持项目级换源", "Some package managers support project-level source changing"); chef_allow_english(this); diff --git a/src/recipe/lang/Python/pip.c b/src/recipe/lang/Python/pip.c index b4a27f0..db26c49 100644 --- a/src/recipe/lang/Python/pip.c +++ b/src/recipe/lang/Python/pip.c @@ -15,7 +15,7 @@ pl_python_pip_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/Python/uv.c b/src/recipe/lang/Python/uv.c index f56d9fe..83f90b1 100644 --- a/src/recipe/lang/Python/uv.c +++ b/src/recipe/lang/Python/uv.c @@ -15,7 +15,7 @@ pl_python_uv_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@happy-game"); - chef_set_contributors (this, 2, "@Kattos", "@ccmywish"); + chef_set_sauciers (this, 2, "@Kattos", "@ccmywish"); chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/R.c b/src/recipe/lang/R.c index f6d625d..3583a6d 100644 --- a/src/recipe/lang/R.c +++ b/src/recipe/lang/R.c @@ -15,7 +15,7 @@ pl_r_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@hezonglun"); + chef_set_sauciers (this, 1, "@hezonglun"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/lang/Ruby/Ruby.c b/src/recipe/lang/Ruby/Ruby.c index 065e025..00842f8 100644 --- a/src/recipe/lang/Ruby/Ruby.c +++ b/src/recipe/lang/Ruby/Ruby.c @@ -22,7 +22,7 @@ pl_ruby_prelude (void) chef_set_chef (this, "@ccmywish"); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, PartiallyCan, "支持 bundler. 不支持 gem", "Support bundler. Not support gem"); chef_allow_english(this); diff --git a/src/recipe/lang/Rust/Cargo.c b/src/recipe/lang/Rust/Cargo.c index 68afe0a..770d9c2 100644 --- a/src/recipe/lang/Rust/Cargo.c +++ b/src/recipe/lang/Rust/Cargo.c @@ -15,7 +15,7 @@ pl_rust_cargo_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@Mikachu2333"); + chef_set_sauciers (this, 1, "@Mikachu2333"); chef_allow_local_mode (this, PartiallyCan, "可以基于本项目换源吗?请帮助确认", "Can it change sources based on this project? Please help confirm"); chef_forbid_english (this); diff --git a/src/recipe/lang/Rust/rustup.c b/src/recipe/lang/Rust/rustup.c index bebb773..401fb3f 100644 --- a/src/recipe/lang/Rust/rustup.c +++ b/src/recipe/lang/Rust/rustup.c @@ -18,7 +18,7 @@ pl_rust_rustup_prelude (void) chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 2, "@Yangmoooo", "@Mikachu2333"); + chef_set_sauciers (this, 2, "@Yangmoooo", "@Mikachu2333"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english (this); diff --git a/src/recipe/os/APT/Armbian.c b/src/recipe/os/APT/Armbian.c index 573022b..619a077 100644 --- a/src/recipe/os/APT/Armbian.c +++ b/src/recipe/os/APT/Armbian.c @@ -15,7 +15,7 @@ os_armbian_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@livelycode36"); - chef_set_contributors (this, 2, "@ccmywish", "@Yangmoooo"); + chef_set_sauciers (this, 2, "@ccmywish", "@Yangmoooo"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/Debian.c b/src/recipe/os/APT/Debian.c index 8a8ebcc..01c871e 100644 --- a/src/recipe/os/APT/Debian.c +++ b/src/recipe/os/APT/Debian.c @@ -15,7 +15,7 @@ os_debian_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 2, "@ccmywish", "@G_I_Y"); - chef_set_contributors (this, 1, "@Yangmoooo"); + chef_set_sauciers (this, 1, "@Yangmoooo"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/Kali-Linux.c b/src/recipe/os/APT/Kali-Linux.c index 15a0e14..1e2be74 100644 --- a/src/recipe/os/APT/Kali-Linux.c +++ b/src/recipe/os/APT/Kali-Linux.c @@ -15,7 +15,7 @@ os_kali_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@G_I_Y"); - chef_set_contributors (this, 2, "@Yangmoooo", "@happy-game"); + chef_set_sauciers (this, 2, "@Yangmoooo", "@happy-game"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/Linux-Lite.c b/src/recipe/os/APT/Linux-Lite.c index 997992c..40c282f 100644 --- a/src/recipe/os/APT/Linux-Lite.c +++ b/src/recipe/os/APT/Linux-Lite.c @@ -15,7 +15,7 @@ os_linuxlite_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@Yangmoooo"); + chef_set_sauciers (this, 1, "@Yangmoooo"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/Linux-Mint.c b/src/recipe/os/APT/Linux-Mint.c index 6f51882..e18b2dc 100644 --- a/src/recipe/os/APT/Linux-Mint.c +++ b/src/recipe/os/APT/Linux-Mint.c @@ -15,7 +15,7 @@ os_linuxmint_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@happy-game"); + chef_set_sauciers (this, 1, "@happy-game"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/ROS.c b/src/recipe/os/APT/ROS.c index 618d247..10a94ee 100644 --- a/src/recipe/os/APT/ROS.c +++ b/src/recipe/os/APT/ROS.c @@ -15,7 +15,7 @@ os_ros_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@G_I_Y"); - chef_set_contributors (this, 2, "@ccmywish", "@zouri"); + chef_set_sauciers (this, 2, "@ccmywish", "@zouri"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/Raspberry-Pi-OS.c b/src/recipe/os/APT/Raspberry-Pi-OS.c index c52cb49..11dae96 100644 --- a/src/recipe/os/APT/Raspberry-Pi-OS.c +++ b/src/recipe/os/APT/Raspberry-Pi-OS.c @@ -17,7 +17,7 @@ os_raspberrypi_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@Yangmoooo"); + chef_set_sauciers (this, 1, "@Yangmoooo"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/Termux.c b/src/recipe/os/APT/Termux.c index bdceded..0b78b7d 100644 --- a/src/recipe/os/APT/Termux.c +++ b/src/recipe/os/APT/Termux.c @@ -15,7 +15,7 @@ os_termux_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/Trisquel.c b/src/recipe/os/APT/Trisquel.c index c162724..6047c43 100644 --- a/src/recipe/os/APT/Trisquel.c +++ b/src/recipe/os/APT/Trisquel.c @@ -17,7 +17,7 @@ os_trisquel_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/Ubuntu.c b/src/recipe/os/APT/Ubuntu.c index 92f5400..c9b8a82 100644 --- a/src/recipe/os/APT/Ubuntu.c +++ b/src/recipe/os/APT/Ubuntu.c @@ -16,7 +16,7 @@ os_ubuntu_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 2, "@ccmywish", "@G_I_Y"); - chef_set_contributors (this, 1, "@XUANJI233"); + chef_set_sauciers (this, 1, "@XUANJI233"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/deepin.c b/src/recipe/os/APT/deepin.c index ab094d4..637ffa6 100644 --- a/src/recipe/os/APT/deepin.c +++ b/src/recipe/os/APT/deepin.c @@ -15,7 +15,7 @@ os_deepin_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@G_I_Y"); - chef_set_contributors (this, 1, "@Yangmoooo"); + chef_set_sauciers (this, 1, "@Yangmoooo"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/APT/openKylin.c b/src/recipe/os/APT/openKylin.c index 625d1f0..3201938 100644 --- a/src/recipe/os/APT/openKylin.c +++ b/src/recipe/os/APT/openKylin.c @@ -18,7 +18,7 @@ os_openkylin_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@G_I_Y"); - chef_set_contributors (this, 1, "@ccmywish"); + chef_set_sauciers (this, 1, "@ccmywish"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/Alpine-Linux.c b/src/recipe/os/Alpine-Linux.c index 657a76c..0183abc 100644 --- a/src/recipe/os/Alpine-Linux.c +++ b/src/recipe/os/Alpine-Linux.c @@ -15,7 +15,7 @@ os_alpine_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@Yangmoooo"); + chef_set_sauciers (this, 1, "@Yangmoooo"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/os/BSD/FreeBSD.c b/src/recipe/os/BSD/FreeBSD.c index cffcf0d..e8fe85a 100644 --- a/src/recipe/os/BSD/FreeBSD.c +++ b/src/recipe/os/BSD/FreeBSD.c @@ -15,7 +15,7 @@ os_freebsd_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 2, "@ccmywish", "@G_I_Y"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/BSD/NetBSD.c b/src/recipe/os/BSD/NetBSD.c index d5daacf..87f4f36 100644 --- a/src/recipe/os/BSD/NetBSD.c +++ b/src/recipe/os/BSD/NetBSD.c @@ -15,7 +15,7 @@ os_netbsd_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 2, "@ccmywish", "@G_I_Y"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/os/BSD/OpenBSD.c b/src/recipe/os/BSD/OpenBSD.c index 2e5afce..e5d61fc 100644 --- a/src/recipe/os/BSD/OpenBSD.c +++ b/src/recipe/os/BSD/OpenBSD.c @@ -15,7 +15,7 @@ os_openbsd_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 2, "@G_I_Y", "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/Gentoo-Linux.c b/src/recipe/os/Gentoo-Linux.c index 7cd56ac..4e5d3a3 100644 --- a/src/recipe/os/Gentoo-Linux.c +++ b/src/recipe/os/Gentoo-Linux.c @@ -15,7 +15,7 @@ os_gentoo_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@G_I_Y"); - chef_set_contributors (this, 1, "@ccmywish"); + chef_set_sauciers (this, 1, "@ccmywish"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/os/OpenWrt.c b/src/recipe/os/OpenWrt.c index 5b5efa7..36315e8 100644 --- a/src/recipe/os/OpenWrt.c +++ b/src/recipe/os/OpenWrt.c @@ -15,7 +15,7 @@ os_openwrt_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 2, "@Yangmoooo", "@happy-game"); + chef_set_sauciers (this, 2, "@Yangmoooo", "@happy-game"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/os/Solus.c b/src/recipe/os/Solus.c index 966e83f..1ec4bbd 100644 --- a/src/recipe/os/Solus.c +++ b/src/recipe/os/Solus.c @@ -15,7 +15,7 @@ os_solus_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/os/Void-Linux.c b/src/recipe/os/Void-Linux.c index 6f17aec..12c0fa4 100644 --- a/src/recipe/os/Void-Linux.c +++ b/src/recipe/os/Void-Linux.c @@ -15,7 +15,7 @@ os_voidlinux_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@Yangmoooo"); + chef_set_sauciers (this, 1, "@Yangmoooo"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/YUM/AlmaLinux.c b/src/recipe/os/YUM/AlmaLinux.c index 5e709d5..3b5b509 100644 --- a/src/recipe/os/YUM/AlmaLinux.c +++ b/src/recipe/os/YUM/AlmaLinux.c @@ -15,7 +15,7 @@ os_almalinux_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@Yangmoooo"); + chef_set_sauciers (this, 1, "@Yangmoooo"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/YUM/Anolis-OS.c b/src/recipe/os/YUM/Anolis-OS.c index 4127f9c..38f0e9f 100644 --- a/src/recipe/os/YUM/Anolis-OS.c +++ b/src/recipe/os/YUM/Anolis-OS.c @@ -15,7 +15,7 @@ os_anolis_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/YUM/Fedora-Linux.c b/src/recipe/os/YUM/Fedora-Linux.c index 1b744d4..6cd61f2 100644 --- a/src/recipe/os/YUM/Fedora-Linux.c +++ b/src/recipe/os/YUM/Fedora-Linux.c @@ -15,7 +15,7 @@ os_fedora_prelude () chef_set_chef (this, "@happy-game"); chef_set_cooks (this, 2, "@G_I_Y", "@happy-game"); - chef_set_contributors (this, 1, "@ccmywish"); + chef_set_sauciers (this, 1, "@ccmywish"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/YUM/Rocky-Linux.c b/src/recipe/os/YUM/Rocky-Linux.c index 051047b..96a9d48 100644 --- a/src/recipe/os/YUM/Rocky-Linux.c +++ b/src/recipe/os/YUM/Rocky-Linux.c @@ -15,7 +15,7 @@ os_rockylinux_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@happy-game"); + chef_set_sauciers (this, 1, "@happy-game"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/YUM/openEuler.c b/src/recipe/os/YUM/openEuler.c index 47f68b1..3670f65 100644 --- a/src/recipe/os/YUM/openEuler.c +++ b/src/recipe/os/YUM/openEuler.c @@ -15,7 +15,7 @@ os_openeuler_prelude () chef_set_cooks (this, 1, "@G_I_Y"); chef_set_chef (this, NULL); - chef_set_contributors (this, 3, "@ccmywish", "@Yangmoooo", "@happy-game"); + chef_set_sauciers (this, 3, "@ccmywish", "@Yangmoooo", "@happy-game"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/openSUSE.c b/src/recipe/os/openSUSE.c index 8a3cb38..6573850 100644 --- a/src/recipe/os/openSUSE.c +++ b/src/recipe/os/openSUSE.c @@ -15,7 +15,7 @@ os_opensuse_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 2, "@ccmywish", "@G_I_Y"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/pacman/Arch-Linux.c b/src/recipe/os/pacman/Arch-Linux.c index af01323..e9f695b 100644 --- a/src/recipe/os/pacman/Arch-Linux.c +++ b/src/recipe/os/pacman/Arch-Linux.c @@ -18,7 +18,7 @@ os_arch_prelude () chef_set_chef (this, "@happy-game"); chef_set_cooks (this, 2, "@ccmywish", "@G_I_Y"); - chef_set_contributors (this, 1, "@happy-game"); + chef_set_sauciers (this, 1, "@happy-game"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); @@ -120,7 +120,7 @@ os_archlinuxcn_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 2, "@ccmywish", "@G_I_Y"); - chef_set_contributors (this, 1, "@happy-game"); + chef_set_sauciers (this, 1, "@happy-game"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/pacman/MSYS2.c b/src/recipe/os/pacman/MSYS2.c index 08dcfa0..49e31b6 100644 --- a/src/recipe/os/pacman/MSYS2.c +++ b/src/recipe/os/pacman/MSYS2.c @@ -15,7 +15,7 @@ os_msys2_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@G_I_Y"); - chef_set_contributors (this, 1, "@ccmywish"); + chef_set_sauciers (this, 1, "@ccmywish"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/os/pacman/Manjaro-Linux.c b/src/recipe/os/pacman/Manjaro-Linux.c index a1731fe..1859897 100644 --- a/src/recipe/os/pacman/Manjaro-Linux.c +++ b/src/recipe/os/pacman/Manjaro-Linux.c @@ -14,7 +14,7 @@ os_manjaro_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@G_I_Y"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/recipe-template.c b/src/recipe/recipe-template.c index 1d2c2d1..729409f 100644 --- a/src/recipe/recipe-template.c +++ b/src/recipe/recipe-template.c @@ -68,7 +68,7 @@ void chef_set_chef (this, "@ccmywish"); // recipe 负责人 chef_set_cooks (this, 2, "@ccmywish", "@nilnull"); // recipe 核心作者 // 做了贡献?将自己的信息加在这里! - chef_set_contributors (this, 2, "@nulnone", "@someone"); + chef_set_sauciers (this, 2, "@nulnone", "@someone"); chef_allow_local_mode (this, PartiallyCan, "具体说明是否支持项目级换源...", "Tell users the local mode support"); diff --git a/src/recipe/ware/Anaconda/Anaconda.c b/src/recipe/ware/Anaconda/Anaconda.c index 8536d92..3b8bbb6 100644 --- a/src/recipe/ware/Anaconda/Anaconda.c +++ b/src/recipe/ware/Anaconda/Anaconda.c @@ -17,7 +17,7 @@ wr_anaconda_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 2, "@Yangmoooo", "@xyx1926885268"); + chef_set_sauciers (this, 2, "@Yangmoooo", "@xyx1926885268"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/ware/CocoaPods.c b/src/recipe/ware/CocoaPods.c index 78a4aed..108db3a 100644 --- a/src/recipe/ware/CocoaPods.c +++ b/src/recipe/ware/CocoaPods.c @@ -15,7 +15,7 @@ wr_cocoapods_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); diff --git a/src/recipe/ware/Docker/Docker.c b/src/recipe/ware/Docker/Docker.c index 8c9ebc2..aa119c8 100644 --- a/src/recipe/ware/Docker/Docker.c +++ b/src/recipe/ware/Docker/Docker.c @@ -32,7 +32,7 @@ wr_docker_prelude () chef_set_chef (this, "@happy-game"); chef_set_cooks (this, 2, "@happy-game", "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/ware/Emacs.c b/src/recipe/ware/Emacs.c index 1e8663a..a983f4c 100644 --- a/src/recipe/ware/Emacs.c +++ b/src/recipe/ware/Emacs.c @@ -22,7 +22,7 @@ wr_emacs_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/ware/Flatpak.c b/src/recipe/ware/Flatpak.c index 47d06c7..fd2d13b 100644 --- a/src/recipe/ware/Flatpak.c +++ b/src/recipe/ware/Flatpak.c @@ -15,7 +15,7 @@ wr_flatpak_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@jialinlvcn"); + chef_set_sauciers (this, 1, "@jialinlvcn"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/ware/Guix.c b/src/recipe/ware/Guix.c index 5b39725..d6497db 100644 --- a/src/recipe/ware/Guix.c +++ b/src/recipe/ware/Guix.c @@ -15,7 +15,7 @@ wr_guix_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/ware/Homebrew/Homebrew.c b/src/recipe/ware/Homebrew/Homebrew.c index baf2ea6..665d86c 100644 --- a/src/recipe/ware/Homebrew/Homebrew.c +++ b/src/recipe/ware/Homebrew/Homebrew.c @@ -17,7 +17,7 @@ wr_homebrew_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@Word2VecT"); + chef_set_sauciers (this, 1, "@Word2VecT"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/ware/Nix.c b/src/recipe/ware/Nix.c index 72b8756..7aca1a9 100644 --- a/src/recipe/ware/Nix.c +++ b/src/recipe/ware/Nix.c @@ -15,7 +15,7 @@ wr_nix_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 0); + chef_set_sauciers (this, 0); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/ware/TeX-Live.c b/src/recipe/ware/TeX-Live.c index 10d89f1..fa034ac 100644 --- a/src/recipe/ware/TeX-Live.c +++ b/src/recipe/ware/TeX-Live.c @@ -17,7 +17,7 @@ wr_tex_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@Mikachu2333"); + chef_set_sauciers (this, 1, "@Mikachu2333"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/ware/WinGet.c b/src/recipe/ware/WinGet.c index 2bd3265..8f08ac8 100644 --- a/src/recipe/ware/WinGet.c +++ b/src/recipe/ware/WinGet.c @@ -15,7 +15,7 @@ wr_winget_prelude () chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_contributors (this, 1, "@Mikachu2333"); + chef_set_sauciers (this, 1, "@Mikachu2333"); chef_forbid_english(this); chef_allow_user_define(this); From 64924a7ffc16d0a2abb8669f48f88398a9e365cf Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 14:40:25 +0800 Subject: [PATCH 090/103] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=E4=B8=BA=20?= =?UTF-8?q?`chsrc=5Fuse=5Fthis=5Fsource()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/struct.h | 2 +- src/recipe/lang/Clojure.c | 2 +- src/recipe/lang/Dart/Flutter.c | 2 +- src/recipe/lang/Dart/Pub.c | 2 +- src/recipe/lang/Go.c | 2 +- src/recipe/lang/Haskell.c | 2 +- src/recipe/lang/Java.c | 2 +- src/recipe/lang/JavaScript/JavaScript.c | 2 +- src/recipe/lang/Julia.c | 2 +- src/recipe/lang/Lua.c | 2 +- src/recipe/lang/OCaml.c | 2 +- src/recipe/lang/PHP.c | 2 +- src/recipe/lang/Perl.c | 2 +- src/recipe/lang/Python/Python.c | 2 +- src/recipe/lang/R.c | 2 +- src/recipe/lang/Ruby/Ruby.c | 2 +- src/recipe/lang/Rust/Cargo.c | 2 +- src/recipe/lang/Rust/rustup.c | 2 +- src/recipe/os/APT/Armbian.c | 2 +- src/recipe/os/APT/Debian.c | 4 ++-- src/recipe/os/APT/Kali-Linux.c | 2 +- src/recipe/os/APT/Linux-Lite.c | 2 +- src/recipe/os/APT/Linux-Mint.c | 2 +- src/recipe/os/APT/ROS.c | 2 +- src/recipe/os/APT/Raspberry-Pi-OS.c | 2 +- src/recipe/os/APT/Termux.c | 2 +- src/recipe/os/APT/Trisquel.c | 2 +- src/recipe/os/APT/Ubuntu.c | 4 ++-- src/recipe/os/APT/deepin.c | 2 +- src/recipe/os/APT/openKylin.c | 2 +- src/recipe/os/Alpine-Linux.c | 2 +- src/recipe/os/BSD/NetBSD.c | 2 +- src/recipe/os/BSD/OpenBSD.c | 2 +- src/recipe/os/Gentoo-Linux.c | 2 +- src/recipe/os/OpenWrt.c | 2 +- src/recipe/os/Solus.c | 2 +- src/recipe/os/Void-Linux.c | 2 +- src/recipe/os/YUM/AlmaLinux.c | 2 +- src/recipe/os/YUM/Anolis-OS.c | 2 +- src/recipe/os/YUM/Fedora-Linux.c | 2 +- src/recipe/os/YUM/Rocky-Linux.c | 2 +- src/recipe/os/YUM/openEuler.c | 2 +- src/recipe/os/openSUSE.c | 2 +- src/recipe/os/pacman/Arch-Linux.c | 4 ++-- src/recipe/os/pacman/MSYS2.c | 2 +- src/recipe/recipe-template.c | 2 +- src/recipe/ware/Anaconda/Anaconda.c | 2 +- src/recipe/ware/CocoaPods.c | 2 +- src/recipe/ware/Docker/Docker.c | 2 +- src/recipe/ware/Emacs.c | 2 +- src/recipe/ware/Flatpak.c | 2 +- src/recipe/ware/Guix.c | 2 +- src/recipe/ware/Homebrew/Homebrew.c | 2 +- src/recipe/ware/Nix.c | 2 +- src/recipe/ware/TeX-Live.c | 2 +- src/recipe/ware/WinGet.c | 2 +- 56 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/framework/struct.h b/src/framework/struct.h index e984893..caaf8d6 100644 --- a/src/framework/struct.h +++ b/src/framework/struct.h @@ -178,7 +178,7 @@ TargetRegisterInfo_t; #define chef_prep_this(t,op) Target_t *this = &t##_target; this->inited = true; chef_allow_##op(t); #define use_this(t) Target_t *this = &t##_target; -#define use_this_source(t) Target_t *this = &t##_target; Source_t source = chsrc_yield_source_and_confirm (this, option); +#define chsrc_use_this_source(t) Target_t *this = &t##_target; Source_t source = chsrc_yield_source_and_confirm (this, option); #define def_sources_begin() Source_t sources[] = { #define def_sources_end() }; \ diff --git a/src/recipe/lang/Clojure.c b/src/recipe/lang/Clojure.c index 96eafd5..e052f81 100644 --- a/src/recipe/lang/Clojure.c +++ b/src/recipe/lang/Clojure.c @@ -36,7 +36,7 @@ pl_clojure_prelude () void pl_clojure_setsrc (char *option) { - use_this_source(pl_clojure); + chsrc_use_this_source (pl_clojure); if (chsrc_in_local_mode()) { diff --git a/src/recipe/lang/Dart/Flutter.c b/src/recipe/lang/Dart/Flutter.c index 895713e..3fe1332 100644 --- a/src/recipe/lang/Dart/Flutter.c +++ b/src/recipe/lang/Dart/Flutter.c @@ -51,7 +51,7 @@ pl_dart_flutter_getsrc (char *option) void pl_dart_flutter_setsrc (char *option) { - use_this_source(pl_dart_flutter); + chsrc_use_this_source (pl_dart_flutter); char *w = NULL; char *cmd = NULL; diff --git a/src/recipe/lang/Dart/Pub.c b/src/recipe/lang/Dart/Pub.c index d0a685c..19c6078 100644 --- a/src/recipe/lang/Dart/Pub.c +++ b/src/recipe/lang/Dart/Pub.c @@ -47,7 +47,7 @@ pl_dart_getsrc (char *option) void pl_dart_setsrc (char *option) { - use_this_source(pl_dart); + chsrc_use_this_source (pl_dart); char *w = NULL; char *cmd = NULL; diff --git a/src/recipe/lang/Go.c b/src/recipe/lang/Go.c index 6d58e33..d3a2559 100644 --- a/src/recipe/lang/Go.c +++ b/src/recipe/lang/Go.c @@ -80,7 +80,7 @@ pl_go_setsrc (char *option) { pl_go_check_cmd (); - use_this_source(pl_go); + chsrc_use_this_source (pl_go); char *cmd = "go env -w GO111MODULE=on"; chsrc_run (cmd, RunOpt_Default); diff --git a/src/recipe/lang/Haskell.c b/src/recipe/lang/Haskell.c index ad6461b..f07e3c5 100644 --- a/src/recipe/lang/Haskell.c +++ b/src/recipe/lang/Haskell.c @@ -39,7 +39,7 @@ pl_haskell_prelude () void pl_haskell_setsrc (char *option) { - use_this_source(pl_haskell); + chsrc_use_this_source (pl_haskell); char *content = xy_str_gsub (RAWSTR_pl_haskell_cabal_config, "@url@", source.url); diff --git a/src/recipe/lang/Java.c b/src/recipe/lang/Java.c index 4d5eadd..47435be 100644 --- a/src/recipe/lang/Java.c +++ b/src/recipe/lang/Java.c @@ -77,7 +77,7 @@ pl_java_setsrc (char *option) bool maven_exist, gradle_exist; pl_java_check_cmd (&maven_exist, &gradle_exist); - use_this_source(pl_java); + chsrc_use_this_source (pl_java); if (maven_exist) { diff --git a/src/recipe/lang/JavaScript/JavaScript.c b/src/recipe/lang/JavaScript/JavaScript.c index 235c17c..0c9faef 100644 --- a/src/recipe/lang/JavaScript/JavaScript.c +++ b/src/recipe/lang/JavaScript/JavaScript.c @@ -70,7 +70,7 @@ pl_js_group_setsrc (char *option) chsrc_set_target_group_mode (); - use_this_source (pl_js_group); + chsrc_use_this_source (pl_js_group); if (npm_exist) { diff --git a/src/recipe/lang/Julia.c b/src/recipe/lang/Julia.c index f225b57..e8815fd 100644 --- a/src/recipe/lang/Julia.c +++ b/src/recipe/lang/Julia.c @@ -52,7 +52,7 @@ pl_julia_getsrc (char *option) void pl_julia_setsrc (char *option) { - use_this_source(pl_julia); + chsrc_use_this_source (pl_julia); char *w = xy_strcat (3, "ENV[\"JULIA_PKG_SERVER\"] = \"", source.url, "\""); diff --git a/src/recipe/lang/Lua.c b/src/recipe/lang/Lua.c index 738689d..42b179d 100644 --- a/src/recipe/lang/Lua.c +++ b/src/recipe/lang/Lua.c @@ -48,7 +48,7 @@ pl_lua_getsrc (char *option) void pl_lua_setsrc (char *option) { - use_this_source (pl_lua); + chsrc_use_this_source (pl_lua); char *config = xy_strcat (3, "rocks_servers = {\n" " \"", source.url, "\"\n" diff --git a/src/recipe/lang/OCaml.c b/src/recipe/lang/OCaml.c index a70cdd2..d5e064f 100644 --- a/src/recipe/lang/OCaml.c +++ b/src/recipe/lang/OCaml.c @@ -51,7 +51,7 @@ pl_ocaml_setsrc (char *option) { pl_ocaml_check_cmd (); - use_this_source(pl_ocaml); + chsrc_use_this_source (pl_ocaml); char *cmd = xy_strcat (3, "opam repo set-url default ", source.url, diff --git a/src/recipe/lang/PHP.c b/src/recipe/lang/PHP.c index 228beda..fbea3e7 100644 --- a/src/recipe/lang/PHP.c +++ b/src/recipe/lang/PHP.c @@ -55,7 +55,7 @@ pl_php_setsrc (char *option) { pl_php_check_cmd (); - use_this_source (pl_php); + chsrc_use_this_source (pl_php); char *where = " -g "; if (chsrc_in_local_mode()) diff --git a/src/recipe/lang/Perl.c b/src/recipe/lang/Perl.c index f107370..f998bb4 100644 --- a/src/recipe/lang/Perl.c +++ b/src/recipe/lang/Perl.c @@ -57,7 +57,7 @@ pl_perl_getsrc (char *option) void pl_perl_setsrc (char *option) { - use_this_source(pl_perl); + chsrc_use_this_source (pl_perl); char *cmd = xy_strcat (3, "perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('urllist', 'unshift', '", source.url, "'); CPAN::HandleConfig->commit()\""); diff --git a/src/recipe/lang/Python/Python.c b/src/recipe/lang/Python/Python.c index 0e4b4e5..e7809f0 100644 --- a/src/recipe/lang/Python/Python.c +++ b/src/recipe/lang/Python/Python.c @@ -58,7 +58,7 @@ pl_python_group_setsrc (char *option) chsrc_set_target_group_mode (); - use_this_source (pl_python_group); + chsrc_use_this_source (pl_python_group); // 交给后面检查命令的存在性 diff --git a/src/recipe/lang/R.c b/src/recipe/lang/R.c index 3583a6d..c259744 100644 --- a/src/recipe/lang/R.c +++ b/src/recipe/lang/R.c @@ -62,7 +62,7 @@ pl_r_getsrc (char *option) void pl_r_setsrc (char *option) { - use_this_source(pl_r); + chsrc_use_this_source (pl_r); char *bioconductor_url = xy_str_delete_suffix (xy_str_delete_suffix (source.url, "cran/"), "CRAN/"); bioconductor_url = xy_2strcat(bioconductor_url, "bioconductor"); diff --git a/src/recipe/lang/Ruby/Ruby.c b/src/recipe/lang/Ruby/Ruby.c index 00842f8..9fe7a11 100644 --- a/src/recipe/lang/Ruby/Ruby.c +++ b/src/recipe/lang/Ruby/Ruby.c @@ -69,7 +69,7 @@ pl_ruby_setsrc (char *option) { chsrc_ensure_program ("gem"); - use_this_source(pl_ruby); + chsrc_use_this_source (pl_ruby); char *cmd = NULL; diff --git a/src/recipe/lang/Rust/Cargo.c b/src/recipe/lang/Rust/Cargo.c index 770d9c2..940b5a8 100644 --- a/src/recipe/lang/Rust/Cargo.c +++ b/src/recipe/lang/Rust/Cargo.c @@ -62,7 +62,7 @@ pl_rust_cargo_getsrc (char *option) void pl_rust_cargo_setsrc (char *option) { - use_this_source(pl_rust_cargo); + chsrc_use_this_source (pl_rust_cargo); char *content = RAWSTR_pl_rust_cargo_config; diff --git a/src/recipe/lang/Rust/rustup.c b/src/recipe/lang/Rust/rustup.c index 401fb3f..2ad6364 100644 --- a/src/recipe/lang/Rust/rustup.c +++ b/src/recipe/lang/Rust/rustup.c @@ -56,7 +56,7 @@ pl_rust_rustup_getsrc (char *option) void pl_rust_rustup_setsrc (char *option) { - use_this_source(pl_rust_rustup); + chsrc_use_this_source (pl_rust_rustup); #ifdef XY_Build_On_Windows diff --git a/src/recipe/os/APT/Armbian.c b/src/recipe/os/APT/Armbian.c index 619a077..ce8e1d2 100644 --- a/src/recipe/os/APT/Armbian.c +++ b/src/recipe/os/APT/Armbian.c @@ -60,7 +60,7 @@ os_armbian_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_armbian); + chsrc_use_this_source (os_armbian); chsrc_backup (OS_Armbian_SourceList); diff --git a/src/recipe/os/APT/Debian.c b/src/recipe/os/APT/Debian.c index 01c871e..970e873 100644 --- a/src/recipe/os/APT/Debian.c +++ b/src/recipe/os/APT/Debian.c @@ -83,7 +83,7 @@ os_debian_does_old_sourcelist_use_cdrom (void) void os_debian_setsrc_for_deb822 (char *option) { - use_this_source(os_debian); + chsrc_use_this_source (os_debian); chsrc_backup (OS_Debian_SourceList_DEB822); @@ -144,7 +144,7 @@ os_debian_setsrc (char *option) } } - use_this_source(os_debian); + chsrc_use_this_source (os_debian); chsrc_alert2 ("如果遇到无法拉取 HTTPS 源的情况,请手动运行:"); say ("apt install apt-transport-https ca-certificates"); diff --git a/src/recipe/os/APT/Kali-Linux.c b/src/recipe/os/APT/Kali-Linux.c index 1e2be74..7b85209 100644 --- a/src/recipe/os/APT/Kali-Linux.c +++ b/src/recipe/os/APT/Kali-Linux.c @@ -47,7 +47,7 @@ os_kali_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_kali); + chsrc_use_this_source (os_kali); chsrc_backup (OS_Apt_SourceList); diff --git a/src/recipe/os/APT/Linux-Lite.c b/src/recipe/os/APT/Linux-Lite.c index 40c282f..5b951a6 100644 --- a/src/recipe/os/APT/Linux-Lite.c +++ b/src/recipe/os/APT/Linux-Lite.c @@ -46,7 +46,7 @@ os_linuxlite_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_linuxlite); + chsrc_use_this_source (os_linuxlite); chsrc_backup (OS_Apt_SourceList); diff --git a/src/recipe/os/APT/Linux-Mint.c b/src/recipe/os/APT/Linux-Mint.c index e18b2dc..36371cf 100644 --- a/src/recipe/os/APT/Linux-Mint.c +++ b/src/recipe/os/APT/Linux-Mint.c @@ -58,7 +58,7 @@ os_linuxmint_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_linuxmint); + chsrc_use_this_source (os_linuxmint); chsrc_backup (OS_LinuxMint_SourceList); diff --git a/src/recipe/os/APT/ROS.c b/src/recipe/os/APT/ROS.c index 10a94ee..fa38c24 100644 --- a/src/recipe/os/APT/ROS.c +++ b/src/recipe/os/APT/ROS.c @@ -55,7 +55,7 @@ os_ros_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_ros); + chsrc_use_this_source (os_ros); chsrc_backup (OS_ROS_SourceList); diff --git a/src/recipe/os/APT/Raspberry-Pi-OS.c b/src/recipe/os/APT/Raspberry-Pi-OS.c index 11dae96..182c51a 100644 --- a/src/recipe/os/APT/Raspberry-Pi-OS.c +++ b/src/recipe/os/APT/Raspberry-Pi-OS.c @@ -50,7 +50,7 @@ os_raspberrypi_setsrc (char *option) { chsrc_ensure_root(); // HELP: 不确定是否需要 - use_this_source(os_raspberrypi); + chsrc_use_this_source (os_raspberrypi); chsrc_backup (OS_RaspberryPi_SourceList); diff --git a/src/recipe/os/APT/Termux.c b/src/recipe/os/APT/Termux.c index 0b78b7d..a0b0eee 100644 --- a/src/recipe/os/APT/Termux.c +++ b/src/recipe/os/APT/Termux.c @@ -59,7 +59,7 @@ os_termux_setsrc (char *option) // chsrc_ensure_root (); Termux下禁止使用root - use_this_source(os_termux); + chsrc_use_this_source (os_termux); char *cmd = xy_strcat (3, "sed -i 's@^\\(deb.*stable main\\)$@#\\1\\ndeb ", source.url, "apt/termux-main stable main@' " OS_Termux_SourceList); diff --git a/src/recipe/os/APT/Trisquel.c b/src/recipe/os/APT/Trisquel.c index 6047c43..3ac2e79 100644 --- a/src/recipe/os/APT/Trisquel.c +++ b/src/recipe/os/APT/Trisquel.c @@ -51,7 +51,7 @@ os_trisquel_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_trisquel); + chsrc_use_this_source (os_trisquel); chsrc_backup (OS_Apt_SourceList); diff --git a/src/recipe/os/APT/Ubuntu.c b/src/recipe/os/APT/Ubuntu.c index c9b8a82..9c4f8a5 100644 --- a/src/recipe/os/APT/Ubuntu.c +++ b/src/recipe/os/APT/Ubuntu.c @@ -75,7 +75,7 @@ os_ubuntu_getsrc (char *option) void os_ubuntu_setsrc_for_deb822 (char *option) { - use_this_source(os_ubuntu); + chsrc_use_this_source (os_ubuntu); chsrc_backup (OS_Ubuntu_SourceList_DEB822); @@ -118,7 +118,7 @@ os_ubuntu_setsrc (char *option) bool sourcelist_exist = ensure_debian_or_ubuntu_old_sourcelist (OS_Is_Ubuntu); - use_this_source(os_ubuntu); + chsrc_use_this_source (os_ubuntu); /* 不存在的时候,用的是我们生成的无效文件,不要备份 */ if (sourcelist_exist) diff --git a/src/recipe/os/APT/deepin.c b/src/recipe/os/APT/deepin.c index 637ffa6..8f01ed1 100644 --- a/src/recipe/os/APT/deepin.c +++ b/src/recipe/os/APT/deepin.c @@ -53,7 +53,7 @@ os_deepin_setsrc (char *option) { chsrc_ensure_root(); - use_this_source(os_deepin); + chsrc_use_this_source (os_deepin); chsrc_backup (OS_Apt_SourceList); diff --git a/src/recipe/os/APT/openKylin.c b/src/recipe/os/APT/openKylin.c index 3201938..8d6ddd4 100644 --- a/src/recipe/os/APT/openKylin.c +++ b/src/recipe/os/APT/openKylin.c @@ -44,7 +44,7 @@ os_openkylin_setsrc (char *option) { chsrc_ensure_root(); - use_this_source(os_openkylin); + chsrc_use_this_source (os_openkylin); chsrc_backup (OS_Apt_SourceList); diff --git a/src/recipe/os/Alpine-Linux.c b/src/recipe/os/Alpine-Linux.c index 0183abc..f7e98bd 100644 --- a/src/recipe/os/Alpine-Linux.c +++ b/src/recipe/os/Alpine-Linux.c @@ -54,7 +54,7 @@ os_alpine_setsrc (char *option) { // chsrc_ensure_root(); // HELP: 不确定是否需要root - use_this_source(os_alpine); + chsrc_use_this_source (os_alpine); char* cmd = xy_strcat (3, "sed -i 's#https\\?://dl-cdn.alpinelinux.org/alpine#", source.url, "#g' /etc/apk/repositories" diff --git a/src/recipe/os/BSD/NetBSD.c b/src/recipe/os/BSD/NetBSD.c index 87f4f36..5358312 100644 --- a/src/recipe/os/BSD/NetBSD.c +++ b/src/recipe/os/BSD/NetBSD.c @@ -58,7 +58,7 @@ os_netbsd_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_netbsd); + chsrc_use_this_source (os_netbsd); chsrc_backup ("/usr/pkg/etc/pkgin/repositories.conf"); diff --git a/src/recipe/os/BSD/OpenBSD.c b/src/recipe/os/BSD/OpenBSD.c index e5d61fc..b099822 100644 --- a/src/recipe/os/BSD/OpenBSD.c +++ b/src/recipe/os/BSD/OpenBSD.c @@ -57,7 +57,7 @@ os_openbsd_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_openbsd); + chsrc_use_this_source (os_openbsd); chsrc_backup ("/etc/installurl"); chsrc_overwrite_file (source.url, "/etc/installurl"); diff --git a/src/recipe/os/Gentoo-Linux.c b/src/recipe/os/Gentoo-Linux.c index 4e5d3a3..4e25fdb 100644 --- a/src/recipe/os/Gentoo-Linux.c +++ b/src/recipe/os/Gentoo-Linux.c @@ -42,7 +42,7 @@ os_gentoo_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_gentoo); + chsrc_use_this_source (os_gentoo); chsrc_backup ("/etc/portage/repos.conf/gentoo.conf"); diff --git a/src/recipe/os/OpenWrt.c b/src/recipe/os/OpenWrt.c index 36315e8..19643ab 100644 --- a/src/recipe/os/OpenWrt.c +++ b/src/recipe/os/OpenWrt.c @@ -57,7 +57,7 @@ os_openwrt_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_openwrt); + chsrc_use_this_source (os_openwrt); chsrc_backup (OS_OpenWRT_SourceConfig); diff --git a/src/recipe/os/Solus.c b/src/recipe/os/Solus.c index 1ec4bbd..989da7b 100644 --- a/src/recipe/os/Solus.c +++ b/src/recipe/os/Solus.c @@ -41,7 +41,7 @@ os_solus_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_solus); + chsrc_use_this_source (os_solus); char *cmd = xy_2strcat ("eopkg add-repo Solus ", source.url); chsrc_run (cmd, RunOpt_Default); diff --git a/src/recipe/os/Void-Linux.c b/src/recipe/os/Void-Linux.c index 12c0fa4..ace7dd6 100644 --- a/src/recipe/os/Void-Linux.c +++ b/src/recipe/os/Void-Linux.c @@ -49,7 +49,7 @@ os_voidlinux_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_voidlinux); + chsrc_use_this_source (os_voidlinux); chsrc_ensure_dir ("/etc/xbps.d"); char *cmd = "cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/"; diff --git a/src/recipe/os/YUM/AlmaLinux.c b/src/recipe/os/YUM/AlmaLinux.c index 3b5b509..95a7224 100644 --- a/src/recipe/os/YUM/AlmaLinux.c +++ b/src/recipe/os/YUM/AlmaLinux.c @@ -43,7 +43,7 @@ os_almalinux_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_almalinux); + chsrc_use_this_source (os_almalinux); char *cmd = xy_strcat (3, "sed -e 's|^mirrorlist=|#mirrorlist=|g' -e 's|^#\\s*baseurl=https://repo.almalinux.org/almalinux|baseurl=", source.url, "|g' -i.bak /etc/yum.repos.d/almalinux*.repo"); diff --git a/src/recipe/os/YUM/Anolis-OS.c b/src/recipe/os/YUM/Anolis-OS.c index 38f0e9f..6761ef7 100644 --- a/src/recipe/os/YUM/Anolis-OS.c +++ b/src/recipe/os/YUM/Anolis-OS.c @@ -39,7 +39,7 @@ os_anolis_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_anolis); + chsrc_use_this_source (os_anolis); char *cmd = xy_strcat (3, "sed -i.bak -E 's|https?://(mirrors\\.openanolis\\.cn/anolis)|", source.url, "|g' /etc/yum.repos.d/*.repo"); chsrc_run (cmd, RunOpt_Default); diff --git a/src/recipe/os/YUM/Fedora-Linux.c b/src/recipe/os/YUM/Fedora-Linux.c index 6cd61f2..9abbed9 100644 --- a/src/recipe/os/YUM/Fedora-Linux.c +++ b/src/recipe/os/YUM/Fedora-Linux.c @@ -50,7 +50,7 @@ os_fedora_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_fedora); + chsrc_use_this_source (os_fedora); chsrc_alert2 ("Fedora 38 及以下版本暂不支持"); diff --git a/src/recipe/os/YUM/Rocky-Linux.c b/src/recipe/os/YUM/Rocky-Linux.c index 96a9d48..db748d7 100644 --- a/src/recipe/os/YUM/Rocky-Linux.c +++ b/src/recipe/os/YUM/Rocky-Linux.c @@ -46,7 +46,7 @@ os_rockylinux_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_rockylinux); + chsrc_use_this_source (os_rockylinux); char *version_str = xy_run ("sed -nr 's/ROCKY_SUPPORT_PRODUCT_VERSION=\"(.*)\"/\\1/p' " ETC_OS_RELEASE, 0); double version = atof (version_str); diff --git a/src/recipe/os/YUM/openEuler.c b/src/recipe/os/YUM/openEuler.c index 3670f65..f7a2517 100644 --- a/src/recipe/os/YUM/openEuler.c +++ b/src/recipe/os/YUM/openEuler.c @@ -60,7 +60,7 @@ os_openeuler_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_openeuler); + chsrc_use_this_source (os_openeuler); chsrc_backup (OS_openEuler_SourceList); diff --git a/src/recipe/os/openSUSE.c b/src/recipe/os/openSUSE.c index 6573850..bb5052f 100644 --- a/src/recipe/os/openSUSE.c +++ b/src/recipe/os/openSUSE.c @@ -43,7 +43,7 @@ os_opensuse_setsrc (char *option) { // chsrc_ensure_root (); - use_this_source(os_opensuse); + chsrc_use_this_source (os_opensuse); while (1) { chsrc_note2 ("请选择你的操作系统为:"); diff --git a/src/recipe/os/pacman/Arch-Linux.c b/src/recipe/os/pacman/Arch-Linux.c index e9f695b..725e152 100644 --- a/src/recipe/os/pacman/Arch-Linux.c +++ b/src/recipe/os/pacman/Arch-Linux.c @@ -66,7 +66,7 @@ os_arch_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_arch); + chsrc_use_this_source (os_arch); chsrc_backup (OS_Pacman_MirrorList); @@ -162,7 +162,7 @@ os_archlinuxcn_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(os_archlinuxcn); + chsrc_use_this_source (os_archlinuxcn); chsrc_backup (OS_Pacman_ArchLinuxCN_MirrorList); diff --git a/src/recipe/os/pacman/MSYS2.c b/src/recipe/os/pacman/MSYS2.c index 49e31b6..825d454 100644 --- a/src/recipe/os/pacman/MSYS2.c +++ b/src/recipe/os/pacman/MSYS2.c @@ -43,7 +43,7 @@ os_msys2_prelude () void os_msys2_setsrc (char *option) { - use_this_source(os_msys2); + chsrc_use_this_source (os_msys2); chsrc_backup ("/etc/pacman.d/mirrorlist.mingw32"); chsrc_backup ("/etc/pacman.d/mirrorlist.mingw64"); diff --git a/src/recipe/recipe-template.c b/src/recipe/recipe-template.c index 729409f..8f75e26 100644 --- a/src/recipe/recipe-template.c +++ b/src/recipe/recipe-template.c @@ -112,7 +112,7 @@ void __setsrc (char *option) { /* 下面这行是必须的,注入 source 变量 */ - use_this_source(_); + chsrc_use_this_source (_); /* 如果是 target group,你可能想要指定不同的 target 来使用它的源 */ // Source_t source = chsrc_yield_source_and_confirm (&pl_js_group_target, option); diff --git a/src/recipe/ware/Anaconda/Anaconda.c b/src/recipe/ware/Anaconda/Anaconda.c index 3b8bbb6..6faba38 100644 --- a/src/recipe/ware/Anaconda/Anaconda.c +++ b/src/recipe/ware/Anaconda/Anaconda.c @@ -52,7 +52,7 @@ wr_anaconda_getsrc (char *option) void wr_anaconda_setsrc (char *option) { - use_this_source(wr_anaconda); + chsrc_use_this_source (wr_anaconda); char *w = xy_str_gsub (RAWSTR_wr_anaconda_condarc, "@1@", source.url); diff --git a/src/recipe/ware/CocoaPods.c b/src/recipe/ware/CocoaPods.c index 108db3a..88f4f78 100644 --- a/src/recipe/ware/CocoaPods.c +++ b/src/recipe/ware/CocoaPods.c @@ -38,7 +38,7 @@ wr_cocoapods_prelude () void wr_cocoapods_setsrc (char *option) { - use_this_source(wr_cocoapods); + chsrc_use_this_source (wr_cocoapods); chsrc_note2 ("请手动执行以下命令:"); p("cd ~/.cocoapods/repos"); diff --git a/src/recipe/ware/Docker/Docker.c b/src/recipe/ware/Docker/Docker.c index aa119c8..65bd54a 100644 --- a/src/recipe/ware/Docker/Docker.c +++ b/src/recipe/ware/Docker/Docker.c @@ -71,7 +71,7 @@ wr_docker_setsrc (char *option) { chsrc_ensure_root (); - use_this_source(wr_docker); + chsrc_use_this_source (wr_docker); if (xy_on_linux || xy_on_bsd) { diff --git a/src/recipe/ware/Emacs.c b/src/recipe/ware/Emacs.c index a983f4c..d0b7e84 100644 --- a/src/recipe/ware/Emacs.c +++ b/src/recipe/ware/Emacs.c @@ -47,7 +47,7 @@ wr_emacs_prelude () void wr_emacs_setsrc (char *option) { - use_this_source(wr_emacs); + chsrc_use_this_source (wr_emacs); chsrc_note2 ("Emacs换源涉及Elisp, 需要手动查阅并换源:"); p (source.url); diff --git a/src/recipe/ware/Flatpak.c b/src/recipe/ware/Flatpak.c index fd2d13b..0163298 100644 --- a/src/recipe/ware/Flatpak.c +++ b/src/recipe/ware/Flatpak.c @@ -63,7 +63,7 @@ wr_flatpak_getsrc (char *option) void wr_flatpak_setsrc (char *option) { - use_this_source(wr_flatpak); + chsrc_use_this_source (wr_flatpak); chsrc_alert2 ("若出现问题,可先调用以下命令:"); char *note = xy_strcat (3, diff --git a/src/recipe/ware/Guix.c b/src/recipe/ware/Guix.c index d6497db..a31483a 100644 --- a/src/recipe/ware/Guix.c +++ b/src/recipe/ware/Guix.c @@ -37,7 +37,7 @@ wr_guix_prelude () void wr_guix_setsrc (char *option) { - use_this_source(wr_guix); + chsrc_use_this_source (wr_guix); char *file = xy_strcat (3, "(list (channel\n" " (inherit (car %default-channels))\n" diff --git a/src/recipe/ware/Homebrew/Homebrew.c b/src/recipe/ware/Homebrew/Homebrew.c index 665d86c..cc76335 100644 --- a/src/recipe/ware/Homebrew/Homebrew.c +++ b/src/recipe/ware/Homebrew/Homebrew.c @@ -53,7 +53,7 @@ wr_homebrew_getsrc (char *option) void wr_homebrew_setsrc (char *option) { - use_this_source(wr_homebrew); + chsrc_use_this_source (wr_homebrew); char *w = xy_str_gsub (RAWSTR_wr_homebrew_config_in_bash, "@1@", source.url); diff --git a/src/recipe/ware/Nix.c b/src/recipe/ware/Nix.c index 7aca1a9..b39379c 100644 --- a/src/recipe/ware/Nix.c +++ b/src/recipe/ware/Nix.c @@ -50,7 +50,7 @@ wr_nix_setsrc (char *option) { wr_nix_check_cmd (); - use_this_source(wr_nix); + chsrc_use_this_source (wr_nix); char *cmd = xy_strcat (3, "nix-channel --add ", source.url, "nixpkgs-unstable nixpkgs"); chsrc_run (cmd, RunOpt_Default); diff --git a/src/recipe/ware/TeX-Live.c b/src/recipe/ware/TeX-Live.c index fa034ac..b267159 100644 --- a/src/recipe/ware/TeX-Live.c +++ b/src/recipe/ware/TeX-Live.c @@ -82,7 +82,7 @@ wr_tex_setsrc (char *option) bool tlmgr_exist, mpm_exist; wr_tex_check_cmd (&tlmgr_exist, &mpm_exist); - use_this_source(wr_tex); + chsrc_use_this_source (wr_tex); char *cmd = NULL; diff --git a/src/recipe/ware/WinGet.c b/src/recipe/ware/WinGet.c index 8f08ac8..a05f2a8 100644 --- a/src/recipe/ware/WinGet.c +++ b/src/recipe/ware/WinGet.c @@ -44,7 +44,7 @@ wr_winget_getsrc (char *option) void wr_winget_setsrc (char *option) { - use_this_source (wr_winget); + chsrc_use_this_source (wr_winget); // 2025.8.17 此前用户可能隐式使用默认源导致 remove 失败,故使用 Dont_Abort chsrc_run ("winget source remove winget", RunOpt_Dont_Abort_On_Failure); From 475e8f30604ffbd0bd05b6a34be8ee74b13a2be9 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 15:01:12 +0800 Subject: [PATCH 091/103] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20`chef=5Fdebug=5Fta?= =?UTF-8?q?rget()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/chef.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/framework/chef.c b/src/framework/chef.c index 9268b9b..9852340 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -322,17 +322,23 @@ chef_debug_target (Target_t *target) } say ("DEBUG Target Information:"); + printf (" Aliases: %s\n", target->aliases); + printf (" Get Function: %p\n", target->getfn); printf (" Set Function: %p\n", target->setfn); printf (" Reset Function: %p\n", target->resetfn); + printf (" Prelude Function: %p\n", target->preludefn); + + printf (" Inited?: %d\n", target->inited); + printf (" Sources: %p\n", target->sources); printf (" Sources Count: %lld\n", target->sources_n); printf (" Chef: %p\n", target->chef); printf (" Cooks: %p\n", target->cooks); printf (" Cooks Count: %lld\n", target->cooks_n); - printf (" Contributors: %p\n", target->contributors); - printf (" Contributors Count: %lld\n", target->contributors_n); + printf (" Sauciers: %p\n", target->sauciers); + printf (" Sauciers Count: %lld\n", target->sauciers_n); #endif } From e7aae2808d3129bc7e6f7ed0e108279edc506515 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 16:05:53 +0800 Subject: [PATCH 092/103] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20`nvm`=20=E7=9A=84?= =?UTF-8?q?=20`ls`=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/chef.c | 114 +++++++++++++++------------- src/recipe/lang/JavaScript/common.h | 4 +- src/recipe/menu.c | 3 + 3 files changed, 67 insertions(+), 54 deletions(-) diff --git a/src/framework/chef.c b/src/framework/chef.c index 9852340..ad4bcf4 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -12,6 +12,57 @@ #pragma once +void +chef_debug_target (Target_t *target) +{ +#ifdef XY_DEBUG + if (!target) + { + chsrc_debug2 ("target", "Target is NULL"); + return; + } + + say ("DEBUG Target Information:"); + printf (" Aliases: %s\n", target->aliases); + + printf (" Get Function: %p\n", target->getfn); + printf (" Set Function: %p\n", target->setfn); + printf (" Reset Function: %p\n", target->resetfn); + printf (" Prelude Function: %p\n", target->preludefn); + + printf (" Inited?: %d\n", target->inited); + + printf (" Sources: %p\n", target->sources); + printf (" Sources Count: %lld\n", target->sources_n); + + printf (" Chef: %p\n", target->chef); + printf (" Cooks: %p\n", target->cooks); + printf (" Cooks Count: %lld\n", target->cooks_n); + printf (" Sauciers: %p\n", target->sauciers); + printf (" Sauciers Count: %lld\n", target->sauciers_n); +#endif +} + + +void +chef_debug_contributor (Contributor_t *contributor) +{ +#ifdef XY_DEBUG + if (!contributor) + { + chsrc_debug2 ("contrib", "Contributor is NULL"); + return; + } + + say ("DEBUG Contributor Information:"); + printf (" ID: %s\n", contributor->id); + printf (" Name: %s\n", contributor->name); + printf (" Email: %s\n", contributor->email); + printf (" DisplayName: %s\n", contributor->display_name); +#endif +} + + /** * @brief 登记所有贡献者 * @@ -107,7 +158,17 @@ chef_set_sources_speed_measure_url_with_postfix (Target_t *target, char *postfix void chef_use_other_target_sources (Target_t *this, Target_t *other) { - if (!other->inited) other->preludefn(); + if (!other->inited) + { + if (other->preludefn) + other->preludefn(); + else + { + chef_debug_target (other); + chsrc_panic ("`other` 未定义 _prelude() !"); + } + } + this->sources = other->sources; this->sources_n = other->sources_n; } @@ -309,54 +370,3 @@ chef_set_sources_last_updated (Target_t *target, char *date) target->sources_last_updated = xy_strdup (date); } - - -void -chef_debug_target (Target_t *target) -{ -#ifdef XY_DEBUG - if (!target) - { - chsrc_debug2 ("target", "Target is NULL"); - return; - } - - say ("DEBUG Target Information:"); - printf (" Aliases: %s\n", target->aliases); - - printf (" Get Function: %p\n", target->getfn); - printf (" Set Function: %p\n", target->setfn); - printf (" Reset Function: %p\n", target->resetfn); - printf (" Prelude Function: %p\n", target->preludefn); - - printf (" Inited?: %d\n", target->inited); - - printf (" Sources: %p\n", target->sources); - printf (" Sources Count: %lld\n", target->sources_n); - - printf (" Chef: %p\n", target->chef); - printf (" Cooks: %p\n", target->cooks); - printf (" Cooks Count: %lld\n", target->cooks_n); - printf (" Sauciers: %p\n", target->sauciers); - printf (" Sauciers Count: %lld\n", target->sauciers_n); -#endif -} - - -void -chef_debug_contributor (Contributor_t *contributor) -{ -#ifdef XY_DEBUG - if (!contributor) - { - chsrc_debug2 ("contrib", "Contributor is NULL"); - return; - } - - say ("DEBUG Contributor Information:"); - printf (" ID: %s\n", contributor->id); - printf (" Name: %s\n", contributor->name); - printf (" Email: %s\n", contributor->email); - printf (" DisplayName: %s\n", contributor->display_name); -#endif -} diff --git a/src/recipe/lang/JavaScript/common.h b/src/recipe/lang/JavaScript/common.h index 2ff97fd..5595b23 100644 --- a/src/recipe/lang/JavaScript/common.h +++ b/src/recipe/lang/JavaScript/common.h @@ -45,7 +45,7 @@ pl_js_group_prelude (void) -def_target(pl_js_nodejs_binary, "__internal_use_nodejs_binary__"); +def_target(pl_js_nodejs_binary, "__internal_target_nodejs_binary__"); void pl_js_nodejs_binary_prelude (void) @@ -53,7 +53,7 @@ pl_js_nodejs_binary_prelude (void) chef_prep_this (pl_js_nodejs_binary, NOOP); chef_set_created_on (this, "2023-09-09"); - chef_set_last_updated (this, "2025-07-11"); + chef_set_last_updated (this, "2025-08-22"); chef_set_sources_last_updated (this, "2025-07-11"); chef_set_chef (this, NULL); diff --git a/src/recipe/menu.c b/src/recipe/menu.c index 32d59c1..e16433b 100644 --- a/src/recipe/menu.c +++ b/src/recipe/menu.c @@ -183,6 +183,9 @@ chsrc_init_menu () add (tex); add (anaconda); #undef add + + // Internal Target 不会由用户使用,需要特殊对待 + pl_js_nodejs_binary_target.preludefn = pl_js_nodejs_binary_prelude; } From 4237e8272a0c4196386dd3dadabca4dbf2c98b98 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 16:06:16 +0800 Subject: [PATCH 093/103] =?UTF-8?q?DEBUG=20=E6=A8=A1=E5=BC=8F=E4=B8=8B?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E6=89=80=E6=9C=89=20prelude?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chsrc-main.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index a6574f8..d4bdf2e 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -505,6 +505,36 @@ iterate_menu (XySeq_t *menu, const char *input, Target_t **target) } +void +callback_perform_all_prelude_for_menu (void *data, void *NOUSE) +{ + Target_t *target = (Target_t *) data; + + if (!target->preludefn) + { + chef_debug_target (target); + chsrc_panic ("未定义 _prelude() !"); + } + + target->preludefn(); +} + +/** + * @brief 用于检查所有 _prelude() 是否能正常工作 + * + * 为了防止 DEBUG 模式下运行流程和普通模式下运行流程不一样,我们只在 Get, Set, Reset + * 之后才运行该函数 + */ +void +chsrc_perform_all_prelude () +{ + chsrc_debug ("prelude", "DEBUG模式下, 额外检查所有 _prelude() 是否能正常工作"); + xy_seq_each (ProgStore.pl, callback_perform_all_prelude_for_menu, NULL); + xy_seq_each (ProgStore.os, callback_perform_all_prelude_for_menu, NULL); + xy_seq_each (ProgStore.wr, callback_perform_all_prelude_for_menu, NULL); +} + + /** * @brief 在必要的时期,最后告诉用户一些信息 */ @@ -618,7 +648,10 @@ get_target (const char *input, TargetOp code, char *option) chsrc_op_epilogue (); } +#ifdef XY_DEBUG chef_debug_target (target); + chsrc_perform_all_prelude (); +#endif return true; } From 536caa73ebe522bca741e4266cb9f9cccb364e0b Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 16:29:52 +0800 Subject: [PATCH 094/103] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- doc/01-开发与构建.md | 8 ++++---- doc/02-提交与贡献.md | 15 +++++++------- doc/10-如何编写recipe.md | 6 +++--- doc/11-如何设置换源链接与测速链接.md | 4 ++-- doc/50-协作者与维护者.md | 29 ++++++++++++++++++++-------- 6 files changed, 41 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 8aa838d..a4eb3e6 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ ! ------------------------------------------------------------- ! Doc Type : Markdown ! Doc Name : README.md - ! Doc Authors : Aoran Zeng + ! Doc Authors : 曾奥然 ! Contributors : Mikachu2333 ! | ! Created On : <2023-12-28> - ! Last Modified : <2025-08-17> + ! Last Modified : <2025-08-22> ! ---------------------------------------------------------- -->
@@ -67,7 +67,7 @@ --- > [!IMPORTANT] -> **`chsrc` 可换源 65+ 目标。每个人仅仅贡献和维护自己熟悉的部分,回报是得到其他所有领域专家的帮助。** [欢迎成为 recipe 维护者](https://github.com/RubyMetric/chsrc/issues/130) +> **`chsrc` 可换源 65+ 目标。每个人仅仅贡献和维护自己熟悉的部分,回报是得到其他所有领域专家的帮助。** [欢迎成为 recipe 维护者](https://github.com/RubyMetric/chsrc/issues/275)
diff --git a/doc/01-开发与构建.md b/doc/01-开发与构建.md index bbea6c8..27a1422 100644 --- a/doc/01-开发与构建.md +++ b/doc/01-开发与构建.md @@ -3,11 +3,11 @@ ! ------------------------------------------------------------- ! Doc Type : Markdown ! Doc Name : 01-开发与构建.md - ! Doc Authors : Aoran Zeng - ! Contributors : Nul None + ! Doc Authors : 曾奥然 + ! Contributors : Nul None ! | ! Created On : <2024-12-27> - ! Last Modified : <2025-07-21> + ! Last Modified : <2025-08-22> ! ---------------------------------------------------------- --> # 开发 chsrc @@ -53,7 +53,7 @@ git clone https://gitee.com/RubyMetric/chsrc.git -b dev 3. **`RELEASE mode`** 4. **`CI-RELEASE mode`** -第四种只在 GitHub Actions 使用,一般只需要前三者;而在开发时你仅需要前两者;如果不需要 Debug,仅仅第一个 **DEV mode** 就够了。 +开发时只需要前两种模式;第四种模式只在 GitHub Actions 使用。 **如果你使用 `just`,可以在 VS Code 中获得更好的体验,按 `Ctrl-Shift-B` 直接使用 DEV mode 构建** diff --git a/doc/02-提交与贡献.md b/doc/02-提交与贡献.md index eefc4fc..288e26b 100644 --- a/doc/02-提交与贡献.md +++ b/doc/02-提交与贡献.md @@ -3,11 +3,11 @@ ! ------------------------------------------------------------- ! Doc Type : Markdown ! Doc Name : 02-提交与贡献.md - ! Doc Authors : Aoran Zeng - ! Contributors : Nul None + ! Doc Authors : 曾奥然 + ! Contributors : Nul None ! | ! Created On : <2024-12-13> - ! Last Modified : <2025-07-21> + ! Last Modified : <2025-08-22> ! ---------------------------------------------------------- --> # 贡献说明 @@ -22,6 +22,8 @@ ## 提交与审阅 +当你提交 PR 的时候,一定要将 PR 指定 chsrc 原仓库的 dev 分支。 + ### 一个简单的 Bug 一个简单的 Bug fix,有写权限的维护者可以直接推送到主仓库的 `dev` 分支 @@ -34,15 +36,14 @@ (1) -1. **如果你是 recipe Chef,则你完全负责这个 recipe,如果你拥有写权限,你可以直接推送代码到 `dev` 分支** -2. 如果你是 recipe Cook,则你需要参考 recipe 中记录的 Cook 信息,如果只有你一个人,且你拥有写权限,你可以直接推送代码。如果有多人,则需要提一个 issue,介绍方案,然后 @ 所有 Cook 来 review +**如果你是 recipe Chef,则你完全负责这个 recipe,如果你拥有写权限,你可以直接推送代码到 `dev` 分支** --- (2) -1. 需要先搜索你修改的部分涉及到的 recipe,然后提 issue @ 所有相关的 recipe Cook 来 review -2. 如果涉及了所有 recipe,则 @ framework Cook,而无需把所有 recipe 的 Cook 都喊过来,但是如果觉得有必要,可以 @ 任意你觉得有能力 review 和能给出建议的人来 review +1. 需要先搜索你修改的部分涉及到的 recipe,然后提 issue @ 所有相关的 recipe Chef 来 review +2. 如果涉及了所有 recipe,则 @ framework Chef,而无需把所有 recipe 的 Chef 都喊过来,但是如果觉得有必要,可以 @ 任意你觉得有能力 review 和能给出建议的人来 review
diff --git a/doc/10-如何编写recipe.md b/doc/10-如何编写recipe.md index 518af2e..c4f457f 100644 --- a/doc/10-如何编写recipe.md +++ b/doc/10-如何编写recipe.md @@ -3,11 +3,11 @@ ! ------------------------------------------------------------- ! Doc Type : Markdown ! Doc Name : 10-如何编写recipe.md - ! Doc Authors : Aoran Zeng - ! Contributors : Nul None + ! Doc Authors : 曾奥然 + ! Contributors : Nul None ! | ! Created On : <2024-08-19> - ! Last Modified : <2025-08-17> + ! Last Modified : <2025-08-22> ! ---------------------------------------------------------- --> # Write A Recipe Even If You Don't Know C diff --git a/doc/11-如何设置换源链接与测速链接.md b/doc/11-如何设置换源链接与测速链接.md index b38fbc5..f50ef68 100644 --- a/doc/11-如何设置换源链接与测速链接.md +++ b/doc/11-如何设置换源链接与测速链接.md @@ -3,8 +3,8 @@ ! ------------------------------------------------------------- ! Doc Type : Markdown ! Doc Name : 11-如何设置换源链接与测速链接.md - ! Doc Authors : Aoran Zeng - ! Contributors : Nul None + ! Doc Authors : 曾奥然 + ! Contributors : Nul None ! | ! Created On : <2025-08-11> ! Last Modified : <2025-08-11> diff --git a/doc/50-协作者与维护者.md b/doc/50-协作者与维护者.md index 9cd46a4..861ffad 100644 --- a/doc/50-协作者与维护者.md +++ b/doc/50-协作者与维护者.md @@ -1,21 +1,34 @@ + + # 协作者与维护者 -作为该语言的资深用户、该软件的专家、镜像站维护人员等,你总是对镜像站和源的可用状态拥有一手信息,我们需要你的帮助。如果想要达到最理想的维护状态,每一个 recipe 都需要有专人长时间维护。所以我们在这个文件记录的是愿意**长期**维护的人,如果是一次性提交代码,只需要在对应 recipe 的文件标头中记录即可。 - -**我们的代码里使用了 recipe (某个菜的烹饪方法) 这个词,因而整个项目便和 "饮食" 有关,比如 `menu`: 汇集了所有的 target 的菜单。因此,我们的维护者身份依然使用了这个惯例:** - -一个 recipe 的协作者可分为: +想要达到最理想的维护状态,每一个 recipe 都需要有专人长时间维护。**我们的代码里使用了 recipe (某个菜的烹饪方法) 这个词,因而整个项目便和 "饮食" 有关,比如 `menu`: 汇集了所有的 target 的菜单。因此,我们的维护者和贡献者身份依然使用了这个惯例:** 1. **Chef** - 主厨: 对一个 recipe 完全负责,有写权限时可以直接推代码 + 品控 (主厨): 对一个 recipe 完全负责,有写权限时可以直接推代码 **目前项目的发展阶段还处于 *外行实现内行* 的情况,比如 Homebrew recipe,实现者根本不是 Homebrew 的真实用户,只是根据各种文档来实现,然后等待用户反馈。所以这里当前的实现者最多只能是 Cook,无法承担 Chef 的责任** 2. **Cook** - 副厨:实现和持续维护 recipe,需要和 Chef 一起 review 代码。可参考 [03-CONTRIBUTING.md](./03-CONTRIBUTING.md) 了解项目是如何进行提交和审阅代码的 + 掌勺:一个 recipe 的主要作者 + +3. **Saucier** + + 调味:一个 recipe 的次要贡献者 (除主要作者外的其他人)
-**项目采用申请制,Chef 仅有1人,Cook 可有多人。请提交 PULL REQUEST 在对应的 recipe 文件中添加自己,并在 [issue #130](https://github.com/RubyMetric/chsrc/issues/130) 留言。** +**Chef 采用申请制,每个 recipe 仅有1人,请提交 PULL REQUEST 在对应的 recipe 文件中添加自己,并在 [issue #275 +](https://github.com/RubyMetric/chsrc/issues/275) 留言。** From 18ba902da51cecc7eb2d4af84a62f46d106f820c Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 16:41:05 +0800 Subject: [PATCH 095/103] =?UTF-8?q?=E8=A7=84=E8=8C=83=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/framework/core.c b/src/framework/core.c index 4c7ed0a..867fcb5 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -332,11 +332,11 @@ log_cmd_result (bool result, int exit_status) /** * 检测二进制程序是否存在 * - * @param check_cmd 检测 @param:prog_name 是否存在的一段命令,一般来说,填 @param:prog_name 本身即可, + * @param check_cmd 检测 `prog_name` 是否存在的一段命令,一般来说,填 `prog_name` 本身即可, * 但是某些情况下,需要使用其他命令绕过一些特殊情况,比如 python 这个命令在Windows上 * 会自动打开 Microsoft Store,需避免 * - * @param prog_name 要检测的二进制程序名 + * @param prog_name 要检测的二进制程序名 * */ bool @@ -372,8 +372,8 @@ query_program_exist (char *check_cmd, char *prog_name, int mode) * @brief 生成用于 “检测一个程序是否存在” 的命令,该内部函数由 chsrc_check_program() 家族调用 * * @note - * 1. Unix 中,where 仅在 zsh 中可以使用,sh 和 Bash 中均无法使用,因为其并非二进制程序 - * 2. 因部分linux系统没有 `which` 和 `whereis` 命令,使用 `command -v` 代替 + * 1. Unix 中,'where' 命令仅在 Zsh 中可以使用,sh 和 Bash 中均无法使用,因为其并非二进制程序 + * 2. 因部分 Linux 发行版中没有 'which' 和 'whereis' 命令,使用 'command -v' 代替 */ static char * cmd_to_check_program (char *prog_name) @@ -386,7 +386,6 @@ cmd_to_check_program (char *prog_name) } -XY_Deprecate_This("Use cmd_to_check_program() instead") /** * @brief 通过 `调用程序名 --version` 的方式检测程序是否存在 * @@ -396,6 +395,7 @@ XY_Deprecate_This("Use cmd_to_check_program() instead") * 2. 有一些程序启动速度太慢,即使只调用 --version,也依旧会花费许多时间,比如 mvn * 3. 有些程序并不支持 --version 选项 (虽然基本不可能) */ +XY_Deprecate_This("Use cmd_to_check_program() instead") static char * cmd_to_check_program2 (char *prog_name) { From 25965b18d7e6f97b813f45138219124a01f0ca42 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 16:59:54 +0800 Subject: [PATCH 096/103] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=96=B0=E5=AE=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 3 --- src/chsrc-main.c | 2 +- src/framework/struct.h | 4 +--- src/recipe/lang/Python/PDM.c | 2 +- src/recipe/lang/Python/Rye.c | 2 +- 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index a5a55a8..5a62e70 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -167,9 +167,6 @@ void p (const char *s) { printf ("%s\n", s); } #define xy_c_array_len(arr) (sizeof (arr) / sizeof (arr[0])) -/* @deprecated 应迁移到后者 */ -#define xy_arylen xy_c_array_len - static inline void * xy_malloc0 (size_t size) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index d4bdf2e..29c16b5 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -113,7 +113,7 @@ cli_print_available_mirrors () say ("--------- -------------- ------------------------------------- ---------------------"); } - for (int i = 0; i < xy_arylen (chsrc_available_mirrors); i++) + for (int i = 0; i < xy_c_array_len (chsrc_available_mirrors); i++) { MirrorSite_t *mir = chsrc_available_mirrors[i]; printf ("%-14s%-18s%-41s ", mir->code, mir->abbr, mir->site); say (mir->name); diff --git a/src/framework/struct.h b/src/framework/struct.h index caaf8d6..d8daa3c 100644 --- a/src/framework/struct.h +++ b/src/framework/struct.h @@ -94,8 +94,6 @@ Source_t; /* 由 prelude() 填充 */ #define FeedByPrelude NULL -#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources) - typedef enum Capability_t { @@ -182,7 +180,7 @@ TargetRegisterInfo_t; #define def_sources_begin() Source_t sources[] = { #define def_sources_end() }; \ - this->sources_n = xy_arylen(sources); \ + this->sources_n = xy_c_array_len(sources); \ char *_sources_storage = xy_malloc0 (sizeof(sources)); \ memcpy (_sources_storage, sources, sizeof(sources)); \ this->sources = (Source_t *)_sources_storage; diff --git a/src/recipe/lang/Python/PDM.c b/src/recipe/lang/Python/PDM.c index 276298e..a52b582 100644 --- a/src/recipe/lang/Python/PDM.c +++ b/src/recipe/lang/Python/PDM.c @@ -17,7 +17,7 @@ pl_python_pdm_prelude (void) chef_set_cooks (this, 1, "@ccmywish"); chef_set_sauciers (this, 0); - chef_allow_local_mode (this, FullyCan, "支持项目级配置", "Supports project-level configuration"); + chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/Python/Rye.c b/src/recipe/lang/Python/Rye.c index 709809f..fd1cbfb 100644 --- a/src/recipe/lang/Python/Rye.c +++ b/src/recipe/lang/Python/Rye.c @@ -19,7 +19,7 @@ pl_python_rye_prelude (void) chef_set_cooks (this, 1, "@ccmywish"); chef_set_sauciers (this, 0); - chef_allow_local_mode (this, FullyCan, "支持项目级配置", "Supports project-level configuration"); + chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); chef_allow_user_define(this); From 62679726220479d17fa1b23d3547c03e75b9ed75 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 17:33:13 +0800 Subject: [PATCH 097/103] Misc --- doc/10-如何编写recipe.md | 2 +- doc/README.md | 8 ++++---- src/chsrc-main.c | 6 +++--- src/framework/chef.c | 4 ++-- src/framework/struct.h | 7 ------- src/rawstr4c.md | 4 ++-- 6 files changed, 12 insertions(+), 19 deletions(-) diff --git a/doc/10-如何编写recipe.md b/doc/10-如何编写recipe.md index c4f457f..af88c70 100644 --- a/doc/10-如何编写recipe.md +++ b/doc/10-如何编写recipe.md @@ -18,7 +18,7 @@
-我鼓励你为新的软件添加换源支持,因为通过 `chsrc` 框架,这将比写 shell 脚本更加轻松,你的贡献也将非常有价值。理论上每一个 `recipe` 都需要有专人长时间维护 ([招募](https://github.com/RubyMetric/chsrc/issues/130))。 +我鼓励你为新的软件添加换源支持,因为通过 `chsrc` 框架,这将比写 shell 脚本更加轻松,你的贡献也将非常有价值。理论上每一个 `recipe` 都需要有专人长时间维护 ([招募](https://github.com/RubyMetric/chsrc/issues/275))。 - 本项目采用 `GPLv3+` 协议,是真正的**自由软件**,而非仅仅是开源软件 - 代码规范灵活遵循 `GNU` 标准(若标准干扰了可维护性,则并不采纳) diff --git a/doc/README.md b/doc/README.md index c9f0fda..d1af190 100644 --- a/doc/README.md +++ b/doc/README.md @@ -3,11 +3,11 @@ ! ------------------------------------------------------------- ! Doc Type : Markdown ! Doc Name : (Document Introduction.md) - ! Doc Authors : Aoran Zeng - ! Contributors : Nul None + ! Doc Authors : 曾奥然 + ! Contributors : Nul None ! | ! Created On : <2024-12-27> - ! Last Modified : <2025-08-11> + ! Last Modified : <2025-08-22> ! ---------------------------------------------------------- --> # 文档说明 @@ -23,7 +23,7 @@ E2E (End-to-End) 开发文档: 具体 recipe 相关: - 如何编写一个具体的 recipe,请参考 [10-如何编写recipe.md](./10-如何编写recipe.md) -- 如何修改换源URL、模糊/精准测速URL,请参考 [11-如何设置换源链接与测速链接.md](./11-如何设置换源链接与测速链接.md) +- 如何修改换源链接、模糊/精准测速链接,请参考 [11-如何设置换源链接与测速链接.md](./11-如何设置换源链接与测速链接.md)
diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 29c16b5..86a05d7 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -294,7 +294,7 @@ cli_print_target_features (Target_t *target, const char *input_target_name) } { - char *msg = ENGLISH ? " UserDefine: using user-defined source URL " : " UserDefine: 用户自定义换源URL "; + char *msg = ENGLISH ? " UserDefine: using user-defined source link " : " UserDefine: 用户自定义换源链接 "; char *user_define_msg = xy_strcat (5, msg, "| chsrc set ", input_target_name, " https://user-define-url.org/", input_target_name); if (target->can_user_define) printf (" %s%s\n", bdgreen(YesMark), purple(user_define_msg)); else printf (" %s%s\n", bdred(NoMark), user_define_msg);br(); @@ -426,7 +426,7 @@ cli_print_version () void cli_print_help () { - char *version_string = purple("v" Chsrc_Version "-" Chsrc_Release_Date); + char *version_string = "v" Chsrc_Version "-" Chsrc_Release_Date; const char *raw = CHINESE ? RAWSTR_chsrc_USAGE_CHINESE : RAWSTR_chsrc_USAGE_ENGLISH; @@ -615,7 +615,7 @@ get_target (const char *input, TargetOp code, char *option) { char *msg1 = ENGLISH ? "Mirror abbr" : "镜像站简写"; - char *msg2 = ENGLISH ? "Source URL" : "换源URL"; + char *msg2 = ENGLISH ? "Source URL" : "换源链接"; char *msg3 = ENGLISH ? "Mirror Name" : "镜像站"; char *format = ENGLISH ? " %-13s%-33s%-38s%s\n" : " %-13s%-36s%-46s%s\n"; printf (format, "code", msg1, msg2, msg3); diff --git a/src/framework/chef.c b/src/framework/chef.c index ad4bcf4..1cb94a8 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -113,7 +113,7 @@ chef_set_provider_speed_measure_accuracy (SourceProvider_t *provider, bool accur /** - * @brief 提供一个函数,这个函数基于 "换源 URL" 和用户提供的数据来构造和填充精准测速链接 + * @brief 提供一个函数,这个函数基于 "换源链接" 和用户提供的数据来构造和填充精准测速链接 */ void chef_set_sources_speed_measure_url_with_func ( @@ -143,7 +143,7 @@ chef_set_sources_speed_measure_url_with_func ( /** - * @brief 给 "换源 URL" 增加一个后缀来构造和填充专用测速链接 + * @brief 给 "换源链接" 增加一个后缀来构造和填充专用测速链接 */ void chef_set_sources_speed_measure_url_with_postfix (Target_t *target, char *postfix) diff --git a/src/framework/struct.h b/src/framework/struct.h index d8daa3c..ef3bbdc 100644 --- a/src/framework/struct.h +++ b/src/framework/struct.h @@ -158,13 +158,6 @@ typedef struct Target_t Target_t; -typedef struct TargetRegisterInfo_t -{ - Target_t *target; /* target 本身 */ - void (*prelude) (void); /* 填充 target 信息等预置操作 */ -} -TargetRegisterInfo_t; - #define def_target(t, aliases) void t##_getsrc(char *option);void t##_setsrc(char *option);void t##_resetsrc(char *option); Target_t t##_target={aliases}; diff --git a/src/rawstr4c.md b/src/rawstr4c.md index 0447e3f..9fad98a 100644 --- a/src/rawstr4c.md +++ b/src/rawstr4c.md @@ -72,7 +72,7 @@ 邀请您担任 Chef, 为用户把关您熟悉的 recipe 源代码地址: https://github.com/RubyMetric/chsrc - 成为维护者: https://github.com/RubyMetric/chsrc/issues/130 + 成为维护者: https://github.com/RubyMetric/chsrc/issues/275 ```
@@ -123,7 +123,7 @@ MAINTAIN: We invite you to become a Chef to ensure the quality of recipes you are familiar with for users: Source Code: @url@ - Become a Maintainer: https://github.com/RubyMetric/chsrc/issues/130 + Become a Maintainer: https://github.com/RubyMetric/chsrc/issues/275 ```
From ad1e488b709456cf9bc7cf2a8fa21ebf679bdd39 Mon Sep 17 00:00:00 2001 From: HeZongLun <13425468+hezonglun@user.noreply.gitee.com> Date: Fri, 22 Aug 2025 10:00:51 +0800 Subject: [PATCH 098/103] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86Haskell?= =?UTF-8?q?=E3=80=81Juila=E3=80=81Lua=20=E7=9A=84=E5=AE=98=E6=96=B9?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/recipe/lang/Haskell.c | 2 +- src/recipe/lang/Julia.c | 2 +- src/recipe/lang/Lua.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/recipe/lang/Haskell.c b/src/recipe/lang/Haskell.c index f07e3c5..40413ba 100644 --- a/src/recipe/lang/Haskell.c +++ b/src/recipe/lang/Haskell.c @@ -22,7 +22,7 @@ pl_haskell_prelude () chef_allow_user_define(this); def_sources_begin() - {&UpstreamProvider, NULL, DelegateToUpstream}, + {&UpstreamProvider, "https://hackage.haskell.org", DelegateToUpstream}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/hackage", DelegateToMirror}, {&Bfsu, "https://mirrors.bfsu.edu.cn/hackage", DelegateToMirror}, {&Nju, "https://mirror.nju.edu.cn/hackage", DelegateToMirror}, diff --git a/src/recipe/lang/Julia.c b/src/recipe/lang/Julia.c index e8815fd..7f8c818 100644 --- a/src/recipe/lang/Julia.c +++ b/src/recipe/lang/Julia.c @@ -22,7 +22,7 @@ pl_julia_prelude () chef_allow_user_define(this); def_sources_begin() - {&UpstreamProvider, NULL, DelegateToUpstream}, + {&UpstreamProvider, "https://pkg.julialang.org", DelegateToUpstream}, {&Pku, "https://mirrors.pku.edu.cn/julia", DelegateToMirror}, {&Nju, "https://mirror.nju.edu.cn/julia", DelegateToMirror}, {&Iscas, "https://mirror.iscas.ac.cn/julia", DelegateToMirror} diff --git a/src/recipe/lang/Lua.c b/src/recipe/lang/Lua.c index 42b179d..249b1e4 100644 --- a/src/recipe/lang/Lua.c +++ b/src/recipe/lang/Lua.c @@ -29,7 +29,7 @@ pl_lua_prelude () chef_allow_user_define(this); def_sources_begin() - {&UpstreamProvider, NULL, DelegateToUpstream}, + {&UpstreamProvider, "https://luarocks.org", DelegateToUpstream}, {&Api7, "https://luarocks.cn", DelegateToMirror} def_sources_end() } From 2a3aa2499520a4ae34d5380e990a1cfaefd22cc8 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 17:39:17 +0800 Subject: [PATCH 099/103] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BB=B4=E6=8A=A4?= =?UTF-8?q?=E8=80=85=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/recipe/lang/Haskell.c | 4 ++-- src/recipe/lang/Julia.c | 4 ++-- src/recipe/lang/Lua.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/recipe/lang/Haskell.c b/src/recipe/lang/Haskell.c index 40413ba..c49fd1e 100644 --- a/src/recipe/lang/Haskell.c +++ b/src/recipe/lang/Haskell.c @@ -11,11 +11,11 @@ pl_haskell_prelude () chef_set_created_on (this, "2023-09-10"); chef_set_last_updated (this, "2025-08-10"); - chef_set_sources_last_updated (this, "2023-09-10"); + chef_set_sources_last_updated (this, "2025-08-22"); chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_sauciers (this, 0); + chef_set_sauciers (this, 1, "@hezonglun"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); diff --git a/src/recipe/lang/Julia.c b/src/recipe/lang/Julia.c index 7f8c818..632d83e 100644 --- a/src/recipe/lang/Julia.c +++ b/src/recipe/lang/Julia.c @@ -11,11 +11,11 @@ pl_julia_prelude () chef_set_created_on (this, "2023-08-31"); chef_set_last_updated (this, "2025-08-10"); - chef_set_sources_last_updated (this, "2025-07-14"); + chef_set_sources_last_updated (this, "2025-08-22"); chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_sauciers (this, 0); + chef_set_sauciers (this, 1, "@hezonglun"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); diff --git a/src/recipe/lang/Lua.c b/src/recipe/lang/Lua.c index 249b1e4..52b81f3 100644 --- a/src/recipe/lang/Lua.c +++ b/src/recipe/lang/Lua.c @@ -18,11 +18,11 @@ pl_lua_prelude () chef_set_created_on (this, "2023-09-27"); chef_set_last_updated (this, "2025-08-10"); - chef_set_sources_last_updated (this, "2025-07-14"); + chef_set_sources_last_updated (this, "2025-08-22"); chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); - chef_set_sauciers (this, 0); + chef_set_sauciers (this, 1, "@hezonglun"); chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); From 3f82ef355f04064bdf7a5f0de7fa9fcc7dd32807 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 18:25:59 +0800 Subject: [PATCH 100/103] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20`AlmaLinux`=20?= =?UTF-8?q?=E7=9A=84=E7=B2=BE=E5=87=86=E6=B5=8B=E9=80=9F=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/chef.c | 8 ++++++-- src/recipe/os/YUM/AlmaLinux.c | 9 ++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/framework/chef.c b/src/framework/chef.c index 1cb94a8..0ea21dc 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -91,24 +91,28 @@ chef_register_contributor (char *id, char *name, char *email, char *display_name /** * @brief 修改 Provider 的测速地址 + * + * @note 这个修改的是全局 Provider 里的信息。往往用来设置 UpstreamProvider */ void chef_set_provider_speed_measure_url (SourceProvider_t *provider, char *url) { provider->psmi.skip = NotSkip; provider->psmi.url = xy_strdup (url); - chsrc_debug ("m", xy_strcat (4, "recipe 重新为 ", provider->code, " 设置测速链接: ", url)); + chsrc_debug ("m", xy_strcat (4, "recipe 重新为 ", provider->code, "(镜像站信息本身) 设置测速链接: ", url)); } /** * @brief 修改 Provider 的测速精度 + * + * @note 这个修改的是全局 Provider 里的信息。往往用来设置 UpstreamProvider */ void chef_set_provider_speed_measure_accuracy (SourceProvider_t *provider, bool accuracy) { provider->psmi.accurate = accuracy; - chsrc_debug ("m", xy_strcat (4, "recipe 重新为 ", provider->code, " 设置测速精度: ", accuracy ? "精准" : "粗略")); + chsrc_debug ("m", xy_strcat (4, "recipe 重新为 ", provider->code, "(镜像站信息本身) 设置测速精度: ", accuracy ? "精准" : "粗略")); } diff --git a/src/recipe/os/YUM/AlmaLinux.c b/src/recipe/os/YUM/AlmaLinux.c index 95a7224..2112c3a 100644 --- a/src/recipe/os/YUM/AlmaLinux.c +++ b/src/recipe/os/YUM/AlmaLinux.c @@ -11,7 +11,7 @@ os_almalinux_prelude () chef_set_created_on (this, "2024-06-12"); chef_set_last_updated (this, "2025-08-10"); - chef_set_sources_last_updated (this, "2024-12-18"); + chef_set_sources_last_updated (this, "2025-08-22"); chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@ccmywish"); @@ -24,7 +24,7 @@ os_almalinux_prelude () chef_set_note(this, NULL, NULL); def_sources_begin() - {&UpstreamProvider, "http://repo.almalinux.org/almalinux", FeedByPrelude}, + {&UpstreamProvider, "http://repo.almalinux.org/almalinux", DelegateToUpstream}, {&Ali, "https://mirrors.aliyun.com/almalinux", FeedByPrelude}, {&Volcengine, "https://mirrors.volces.com/almalinux", FeedByPrelude}, {&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/almalinux", FeedByPrelude}, @@ -32,7 +32,10 @@ os_almalinux_prelude () {&Nju, "https://mirror.nju.edu.cn/almalinux", FeedByPrelude} def_sources_end() - chef_set_provider_speed_measure_url (&UpstreamProvider, "https://raw.repo.almalinux.org/almalinux/9.5/isos/x86_64/AlmaLinux-9-latest-x86_64-minimal.iso"); +#define link "/9.6/isos/x86_64/AlmaLinux-9-latest-x86_64-minimal.iso" + chef_set_sources_speed_measure_url_with_postfix (this, link); + chef_set_provider_speed_measure_url (&UpstreamProvider, "https://raw.repo.almalinux.org/almalinux" link); +#undef link } /** From fd21308870d7e489b436cd47f4762a215b32e6c0 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 18:39:58 +0800 Subject: [PATCH 101/103] =?UTF-8?q?Leader=20target=20=E8=AE=B0=E5=BD=95=20?= =?UTF-8?q?follower=20target=20=E8=B4=A1=E7=8C=AE=E8=80=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/recipe/lang/JavaScript/common.h | 7 +++---- src/recipe/lang/Python/common.h | 5 +++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/recipe/lang/JavaScript/common.h b/src/recipe/lang/JavaScript/common.h index 5595b23..03e24ee 100644 --- a/src/recipe/lang/JavaScript/common.h +++ b/src/recipe/lang/JavaScript/common.h @@ -20,11 +20,10 @@ pl_js_group_prelude (void) chef_set_last_updated (this, "2025-07-11"); chef_set_sources_last_updated (this, "2025-07-11"); - chef_set_cooks (this, 1, "@ccmywish"); - chef_set_chef (this, "@happy-game"); - - chef_set_sauciers (this,0); + // 组换源的 leader target 应把所有 follower target 的贡献者都记录过来 + chef_set_cooks (this, 1, "@ccmywish"); + chef_set_sauciers (this, 2, "@lontten", "@MrWillCom"); chef_allow_local_mode (this, PartiallyCan, "支持 npm, yarn v2, pnpm, 不支持 yarn v1", diff --git a/src/recipe/lang/Python/common.h b/src/recipe/lang/Python/common.h index 1233e48..85d521e 100644 --- a/src/recipe/lang/Python/common.h +++ b/src/recipe/lang/Python/common.h @@ -29,8 +29,9 @@ pl_python_group_prelude (void) chef_set_sources_last_updated (this, "2025-07-11"); chef_set_chef (this, "@happy-game"); - chef_set_cooks (this, 1, "@ccmywish"); - chef_set_sauciers (this, 1, "@xyx1926885268"); + // 组换源的 leader target 应把所有 follower target 的贡献者都记录过来 + chef_set_cooks (this, 2, "@ccmywish", "@happy-game"); + chef_set_sauciers (this, 2, "@xyx1926885268", "@Kattos"); chef_allow_local_mode (this, PartiallyCan, "部分包管理器支持项目级换源", "Some package managers support project-level source changing"); chef_allow_english(this); From 981a191de8190bacc8671b15fe4e9c553d30cbee Mon Sep 17 00:00:00 2001 From: Mikachu2333 Date: Fri, 22 Aug 2025 18:54:02 +0800 Subject: [PATCH 102/103] =?UTF-8?q?=E4=BC=98=E5=8C=96=20VS=20Code=20DEBUG?= =?UTF-8?q?=20=E8=AE=BE=E7=BD=AE=20(#270)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/launch.json | 11 ++++--- .vscode/tasks.json | 78 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 82 insertions(+), 7 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index af85601..48cebda 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,13 +8,15 @@ "program": "${workspaceFolder}/chsrc-debug", "args": [ "get", - "python" + "nodejs" ], "preLaunchTask": "构建 debug 版 chsrc", "stopAtEntry": true, "cwd": "${workspaceFolder}", "environment": [], - "externalConsole": false, + // 如果你认为使用弹出窗口难以调试,可尝试设置为false + "externalConsole": true, + // lldb 等请自行设置,不作额外说明 "MIMode": "gdb", // "miDebuggerPath": "/path/to/gdb", "setupCommands": [ @@ -28,7 +30,8 @@ "text": "-gdb-set disassembly-flavor intel", "ignoreFailures": true } - ] + ], + "postDebugTask": "停止 debug 程序" }, { @@ -58,4 +61,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 05447d0..6c4ce8c 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -17,7 +17,8 @@ "kind": "build", "isDefault": true }, - "detail": "使用 just build 编译" + "dependsOn": "停止程序", + "detail": "先停止原有程序,然后使用 just build 编译" }, { "type": "shell", @@ -36,7 +37,6 @@ "kind": "build", "isDefault": false }, - "detail": "使用 just build-in-debug-mode 编译 debug 版" }, { "type": "shell", @@ -94,7 +94,79 @@ "isDefault": false }, "detail": "使用 just test-xy 测试 xy.h" + }, + { + "type": "shell", + "label": "停止 debug 程序", + "windows": { + "command": "powershell", + "args": [ + "-c", + "Get-Process -Name \"chsrc-debug\" -ErrorAction SilentlyContinue | Stop-Process -Force;", + "Get-Process -Name \"gdb\" -ErrorAction SilentlyContinue | Stop-Process -Force;", + "Get-Process -Name \"WindowsDebugLauncher\" -ErrorAction SilentlyContinue | Stop-Process -Force;" + ] + }, + "linux": { + "command": "bash", + "args": [ + "-c", + "if pgrep -f chsrc-debug > /dev/null; then pkill -f chsrc-debug; fi" + ] + }, + "osx": { + "command": "bash", + "args": [ + "-c", + "if pgrep -f chsrc-debug > /dev/null; then pkill -f chsrc-debug; fi" + ] + }, + "group": "build", + "presentation": { + "echo": true, + "reveal": "silent", + "focus": false, + "panel": "shared", + "showReuseMessage": true, + "clear": false + }, + "detail": "停止 debug 版本的 chsrc" + }, + { + "type": "shell", + "label": "停止程序", + "windows": { + "command": "powershell", + "args": [ + "-c", + "Get-Process -Name \"chsrc\" -ErrorAction SilentlyContinue | Stop-Process -Force;" + ] + }, + "linux": { + "command": "bash", + "args": [ + "-c", + "if pgrep -f chsrc > /dev/null; then pkill -f chsrc; fi" + ] + }, + "osx": { + "command": "bash", + "args": [ + "-c", + "if pgrep -f chsrc > /dev/null; then pkill -f chsrc; fi" + ] + }, + "group": "build", + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "shared", + "showReuseMessage": true, + "clear": false + }, + "detail": "跨平台停止 chsrc" } ], "version": "2.0.0" -} +} \ No newline at end of file From 43ff5c3fd16ac4d79eeb4104431dacac627d9fe6 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 22 Aug 2025 19:16:58 +0800 Subject: [PATCH 103/103] =?UTF-8?q?=E6=B6=88=E9=99=A4=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xy.h | 2 ++ src/framework/chef.c | 6 +++--- src/framework/struct.h | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/xy.h b/lib/xy.h index 5a62e70..391ab1b 100644 --- a/lib/xy.h +++ b/lib/xy.h @@ -1033,6 +1033,8 @@ xy_dir_exist (const char *path) else return false; } + + return false; } /** diff --git a/src/framework/chef.c b/src/framework/chef.c index 0ea21dc..6a78794 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -33,13 +33,13 @@ chef_debug_target (Target_t *target) printf (" Inited?: %d\n", target->inited); printf (" Sources: %p\n", target->sources); - printf (" Sources Count: %lld\n", target->sources_n); + printf (" Sources Count: %d\n", target->sources_n); printf (" Chef: %p\n", target->chef); printf (" Cooks: %p\n", target->cooks); - printf (" Cooks Count: %lld\n", target->cooks_n); + printf (" Cooks Count: %d\n", target->cooks_n); printf (" Sauciers: %p\n", target->sauciers); - printf (" Sauciers Count: %lld\n", target->sauciers_n); + printf (" Sauciers Count: %d\n", target->sauciers_n); #endif } diff --git a/src/framework/struct.h b/src/framework/struct.h index ef3bbdc..0800efd 100644 --- a/src/framework/struct.h +++ b/src/framework/struct.h @@ -128,8 +128,8 @@ typedef struct Target_t void (*preludefn) (void); bool inited; /* 是否执行过了 preludefn() */ - Source_t *sources; - size_t sources_n; + Source_t *sources; + int sources_n; /* Features */ @@ -151,9 +151,9 @@ typedef struct Target_t Contributor_t *chef; /* 该 recipe *当前*的总负责人 (可以任职也可以休职) */ Contributor_t **cooks; /* 该 recipe 的主要作者 */ - size_t cooks_n; + int cooks_n; Contributor_t **sauciers; /* 该 recipe 的次要贡献者 (除主要作者外的其他人) */ - size_t sauciers_n; + int sauciers_n; } Target_t;