diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 4185eac..7586798 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -43,7 +43,7 @@ #define Chsrc_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc" #include "framework/core.c" - +#include "framework/chef.c" #include "recipe/lang/rawstr4c.h" @@ -400,16 +400,16 @@ cli_print_target_maintain_info (Target_t *target, const char *input_target_name) say (bdblue(msg)); } - if (target->recipe_authors && target->recipe_authors_n > 0) + if (target->authors && target->authors_n > 0) { char *msg = ENGLISH ? "Recipe Authors: " : "配方作者: "; printf ("%s", bdgreen(msg)); - for (size_t i = 0; i < target->recipe_authors_n; i++) + for (size_t i = 0; i < target->authors_n; i++) { if (i > 0) printf (", "); printf ("%s <%s>", - target->recipe_authors[i].name ? target->recipe_authors[i].name : "Unknown", - target->recipe_authors[i].email ? target->recipe_authors[i].email : "unknown@example.com"); + target->authors[i].name ? target->authors[i].name : "Unknown", + target->authors[i].email ? target->authors[i].email : "unknown@example.com"); } printf ("\n"); } @@ -417,11 +417,11 @@ cli_print_target_maintain_info (Target_t *target, const char *input_target_name) { char *msg = ENGLISH ? "Chef: " : "主厨 Chef: "; - if (target->current_chef) + if (target->chef) { printf ("%s%s <%s>\n", bdgreen(msg), - target->current_chef->name ? target->current_chef->name : "Unknown", - target->current_chef->email ? target->current_chef->email : "unknown@example.com"); + target->chef->name ? target->chef->name : "Unknown", + target->chef->email ? target->chef->email : "unknown@example.com"); } else { @@ -433,15 +433,15 @@ cli_print_target_maintain_info (Target_t *target, const char *input_target_name) { char *msg = ENGLISH ? "Sous Chefs: " : "副厨 Sous Chefs: "; - if (target->current_sous_chefs && target->current_sous_chefs_n > 0) + if (target->sous_chefs && target->sous_chefs_n > 0) { printf ("%s", bdgreen(msg)); - for (size_t i = 0; i < target->current_sous_chefs_n; i++) + for (size_t i = 0; i < target->sous_chefs_n; i++) { if (i > 0) printf (", "); printf ("%s <%s>", - target->current_sous_chefs[i].name ? target->current_sous_chefs[i].name : "Unknown", - target->current_sous_chefs[i].email ? target->current_sous_chefs[i].email : "unknown@example.com"); + target->sous_chefs[i].name ? target->sous_chefs[i].name : "Unknown", + target->sous_chefs[i].email ? target->sous_chefs[i].email : "unknown@example.com"); } printf ("\n"); } @@ -474,16 +474,16 @@ cli_print_target_maintain_info (Target_t *target, const char *input_target_name) } - if (target->recipe_created_on) + if (target->created_on) { char *msg = ENGLISH ? "Recipe Created On: " : "配方创建时间: "; - printf ("%s%s\n", bdgreen(msg), target->recipe_created_on); + printf ("%s%s\n", bdgreen(msg), target->created_on); } - if (target->recipe_last_updated) + if (target->last_updated) { char *msg = ENGLISH ? "Recipe Last Updated: " : "配方最后更新: "; - printf ("%s%s\n", bdgreen(msg), target->recipe_last_updated); + printf ("%s%s\n", bdgreen(msg), target->last_updated); } if (target->sources_last_updated) diff --git a/src/framework/chef.c b/src/framework/chef.c index caad435..7896c23 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -12,9 +12,10 @@ #pragma once -#define chef_allow_get() this->getfn = t##_getsrc; -#define chef_allow_set() this->setfn = t##_setsrc; -#define chef_allow_reset() this->resetfn = t##_resetsrc; +#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; void @@ -114,16 +115,16 @@ chef_set_authors (Target_t *target, size_t count, ...) va_list args; va_start(args, count); - target->recipe_authors = xy_malloc0 (count * sizeof(Contributor_t)); - target->recipe_authors_n = 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->recipe_authors[i].name = xy_strdup(name); - target->recipe_authors[i].email = xy_strdup(email); + target->authors[i].name = xy_strdup(name); + target->authors[i].email = xy_strdup(email); } va_end(args); @@ -136,9 +137,9 @@ chef_set_chef (Target_t *target, char *name, char *email) if (!target || !name || !email) return; - target->current_chef = xy_malloc0 (sizeof(Contributor_t)); - target->current_chef->name = xy_strdup (name); - target->current_chef->email = xy_strdup (email); + target->chef = xy_malloc0 (sizeof(Contributor_t)); + target->chef->name = xy_strdup (name); + target->chef->email = xy_strdup (email); } @@ -150,24 +151,24 @@ chef_set_sous_chefs (Target_t *target, size_t count, ...) if (count == 0) { - target->current_sous_chefs = NULL; - target->current_sous_chefs_n = 0; + target->sous_chefs = NULL; + target->sous_chefs_n = 0; return; } va_list args; va_start(args, count); - target->current_sous_chefs = xy_malloc0 (count * sizeof(Contributor_t)); - target->current_sous_chefs_n = count; + target->sous_chefs = xy_malloc0 (count * sizeof(Contributor_t)); + target->sous_chefs_n = count; for (size_t i = 0; i < count; i++) { char *name = va_arg(args, char*); char *email = va_arg(args, char*); - target->current_sous_chefs[i].name = xy_strdup(name); - target->current_sous_chefs[i].email = xy_strdup(email); + target->sous_chefs[i].name = xy_strdup(name); + target->sous_chefs[i].email = xy_strdup(email); } va_end(args); @@ -180,7 +181,7 @@ chef_set_created_on (Target_t *target, char *date) if (!target) return; - target->recipe_created_on = xy_strdup (date); + target->created_on = xy_strdup (date); } @@ -190,7 +191,7 @@ chef_set_last_updated (Target_t *target, char *date) if (!target) return; - target->recipe_last_updated = xy_strdup (date); + target->last_updated = xy_strdup (date); } @@ -214,7 +215,6 @@ chef_debug_target (Target_t *target) printf (" Get Function: %p\n", target->getfn); printf (" Set Function: %p\n", target->setfn); printf (" Reset Function: %p\n", target->resetfn); - printf (" Feature Function: %p\n", target->featfn); printf (" Sources: %p\n", target->sources); printf (" Sources Count: %lld\n", target->sources_n); printf (" Contributors: %p\n", target->contributors); diff --git a/src/framework/core.c b/src/framework/core.c index 1cd8456..a79ad7c 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -26,7 +26,6 @@ #include "struct.h" #include "mirror.c" #include "chef-helper.c" -#include "chef.c" #define App_Name "chsrc" diff --git a/src/framework/struct.h b/src/framework/struct.h index a04ff12..c39ab94 100644 --- a/src/framework/struct.h +++ b/src/framework/struct.h @@ -123,7 +123,7 @@ typedef struct Target_t void (*setfn) (char *option); void (*resetfn) (char *option); - Source_t sources; + Source_t *sources; size_t sources_n; @@ -172,4 +172,8 @@ TargetRegisterInfo_t; #define use_this(t) Target_t *this = &t##_target; #define def_sources_begin() SourceProvider_t upstream = UpstreamProvider; Source_t sources[] = { -#define def_sources_end() }; this->sources = sources; this->sources_n = xy_arylen(sources); +#define def_sources_end() }; \ + this->sources_n = xy_arylen(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/Clojure.c b/src/recipe/lang/Clojure.c index 9ff7c8b..79b4436 100644 --- a/src/recipe/lang/Clojure.c +++ b/src/recipe/lang/Clojure.c @@ -8,6 +8,7 @@ void pl_clojure_prelude () { use_this(pl_clojure); + chef_allow_s(pl_clojure); chef_set_created_on (this, "2023-09-10"); chef_set_last_updated (this, "2025-08-10"); @@ -18,8 +19,6 @@ pl_clojure_prelude () chef_set_sous_chefs (this, 0); chef_set_contributors (this, 0); - chef_allow_set(); - chef_allow_local_mode (this, Can, NULL, NULL); chef_forbid_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/Dart/Flutter.c b/src/recipe/lang/Dart/Flutter.c index 5c71309..0336d02 100644 --- a/src/recipe/lang/Dart/Flutter.c +++ b/src/recipe/lang/Dart/Flutter.c @@ -10,6 +10,7 @@ void pl_dart_flutter_prelude (void) { use_this(pl_dart_flutter); + chef_allow_gsr(pl_dart_flutter); chef_set_created_on (this, "2023-09-10"); chef_set_last_updated (this, "2025-07-11"); @@ -22,10 +23,6 @@ pl_dart_flutter_prelude (void) "czyt", "czyt.go@gmail.com", "MadDogOwner", "xiaoran@xrgzs.top"); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); - chef_forbid_local_mode (this); chef_allow_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/Dart/Pub.c b/src/recipe/lang/Dart/Pub.c index ad79ab5..a06aef6 100644 --- a/src/recipe/lang/Dart/Pub.c +++ b/src/recipe/lang/Dart/Pub.c @@ -8,6 +8,7 @@ void pl_dart_prelude (void) { use_this(pl_dart); + chef_allow_gsr(pl_dart); chef_set_created_on (this, "2023-09-10"); chef_set_last_updated (this, "2025-07-11"); @@ -20,10 +21,6 @@ pl_dart_prelude (void) "czyt", "czyt.go@gmail.com", "MadDogOwner", "xiaoran@xrgzs.top"); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); - chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/Go.c b/src/recipe/lang/Go.c index 29a002a..c3959dc 100644 --- a/src/recipe/lang/Go.c +++ b/src/recipe/lang/Go.c @@ -22,6 +22,7 @@ void pl_go_prelude () { use_this(pl_go); + chef_allow_gsr(pl_go); chef_set_created_on (this, "2023-08-30"); chef_set_last_updated (this, "2025-08-10"); @@ -34,10 +35,6 @@ pl_go_prelude () "czyt", "czyt.go@gmail.com", "Rui Yang", "techoc@foxmail.com"); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); - chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/Haskell.c b/src/recipe/lang/Haskell.c index d03d36c..fe4414f 100644 --- a/src/recipe/lang/Haskell.c +++ b/src/recipe/lang/Haskell.c @@ -8,6 +8,7 @@ void pl_haskell_prelude () { use_this(pl_haskell); + chef_allow_s(pl_haskell); chef_set_created_on (this, "2023-09-10"); chef_set_last_updated (this, "2025-08-10"); @@ -18,8 +19,6 @@ pl_haskell_prelude () chef_set_sous_chefs (this, 0); chef_set_contributors (this, 0); - chef_allow_set(); - chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/Java.c b/src/recipe/lang/Java.c index 1b03eff..2f16cdb 100644 --- a/src/recipe/lang/Java.c +++ b/src/recipe/lang/Java.c @@ -8,6 +8,7 @@ void pl_java_prelude () { use_this(pl_java); + chef_allow_gsr(pl_java); chef_set_created_on (this, "2023-08-31"); chef_set_last_updated (this, "2025-08-10"); @@ -19,10 +20,6 @@ pl_java_prelude () chef_set_contributors (this, 1, "BingChunMoLi", "bingchunmoli@bingchunmoli.com"); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); - chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/JavaScript/Bun.c b/src/recipe/lang/JavaScript/Bun.c index 1a9be23..fc3ac4f 100644 --- a/src/recipe/lang/JavaScript/Bun.c +++ b/src/recipe/lang/JavaScript/Bun.c @@ -8,6 +8,7 @@ void pl_js_bun_prelude (void) { use_this(pl_js_bun); + chef_allow_gsr(pl_js_bun); chef_set_created_on (this, "2024-09-29"); chef_set_last_updated (this, "2025-07-22"); @@ -19,10 +20,6 @@ pl_js_bun_prelude (void) chef_set_contributors (this, 1, "Lontten", "lontten@163.com"); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); - chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/JavaScript/Yarn.c b/src/recipe/lang/JavaScript/Yarn.c index 99cdbbe..13415e7 100644 --- a/src/recipe/lang/JavaScript/Yarn.c +++ b/src/recipe/lang/JavaScript/Yarn.c @@ -8,6 +8,7 @@ void pl_js_yarn_prelude (void) { use_this(pl_js_yarn); + chef_allow_gsr(pl_js_yarn); chef_set_created_on (this, "2023-09-09"); chef_set_last_updated (this, "2025-07-11"); @@ -19,10 +20,6 @@ pl_js_yarn_prelude (void) chef_set_contributors (this, 1, "Mr. Will", "mr.will.com@outlook.com"); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); - chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/JavaScript/npm.c b/src/recipe/lang/JavaScript/npm.c index 4f49a66..94eb2c8 100644 --- a/src/recipe/lang/JavaScript/npm.c +++ b/src/recipe/lang/JavaScript/npm.c @@ -8,6 +8,7 @@ void pl_js_npm_prelude (void) { use_this(pl_js_npm); + chef_allow_gsr(pl_js_npm); chef_set_created_on (this, "2023-08-30"); chef_set_last_updated (this, "2025-07-11"); @@ -19,10 +20,6 @@ pl_js_npm_prelude (void) chef_set_contributors (this, 1, "Mr. Will", "mr.will.com@outlook.com"); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); - chef_allow_local_mode (this, FullyCan, NULL, NULL); chef_allow_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/JavaScript/nvm.c b/src/recipe/lang/JavaScript/nvm.c index 93e5c36..f4a7191 100644 --- a/src/recipe/lang/JavaScript/nvm.c +++ b/src/recipe/lang/JavaScript/nvm.c @@ -8,6 +8,7 @@ void pl_js_nvm_prelude (void) { use_this(pl_js_nvm); + chef_allow_gsr(pl_js_nvm); chef_set_created_on (this, "2024-09-23"); chef_set_last_updated (this, "2025-06-19"); @@ -16,12 +17,7 @@ pl_js_nvm_prelude (void) chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); chef_set_chef (this, NULL, NULL); chef_set_sous_chefs (this, 0); - chef_set_contributors (this, 1, - "Nul None", "nul@none.org"); - - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); + chef_set_contributors (this, 0); chef_forbid_local_mode (this); chef_allow_english(this); diff --git a/src/recipe/lang/JavaScript/pnpm.c b/src/recipe/lang/JavaScript/pnpm.c index 7089ba0..4f4750a 100644 --- a/src/recipe/lang/JavaScript/pnpm.c +++ b/src/recipe/lang/JavaScript/pnpm.c @@ -8,6 +8,7 @@ void pl_js_pnpm_prelude (void) { use_this(pl_js_pnpm); + chef_allow_gsr(pl_js_pnpm); chef_set_created_on (this, "2024-04-18"); chef_set_last_updated (this, "2025-07-11"); @@ -16,12 +17,7 @@ pl_js_pnpm_prelude (void) chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); chef_set_chef (this, NULL, NULL); chef_set_sous_chefs (this, 0); - chef_set_contributors (this, 1, - "Nul None", "nul@none.org"); - - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); + chef_set_contributors (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 cb7929e..1946d07 100644 --- a/src/recipe/lang/Julia.c +++ b/src/recipe/lang/Julia.c @@ -8,6 +8,7 @@ void pl_julia_prelude () { use_this(pl_julia); + chef_allow_gs(pl_julia); chef_set_created_on (this, "2023-08-31"); chef_set_last_updated (this, "2025-08-10"); @@ -18,9 +19,6 @@ pl_julia_prelude () chef_set_sous_chefs (this, 0); chef_set_contributors (this, 0); - chef_allow_get(); - chef_allow_set(); - chef_allow_local_mode (this, CanNot, NULL, NULL); chef_allow_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/Lua.c b/src/recipe/lang/Lua.c index 275b6e3..cf75aeb 100644 --- a/src/recipe/lang/Lua.c +++ b/src/recipe/lang/Lua.c @@ -15,6 +15,7 @@ void pl_lua_prelude () { use_this(pl_lua); + chef_allow_gs(pl_lua); chef_set_created_on (this, "2023-09-27"); chef_set_last_updated (this, "2025-08-10"); @@ -25,9 +26,6 @@ pl_lua_prelude () chef_set_sous_chefs (this, 0); chef_set_contributors (this, 0); - chef_allow_get(); - chef_allow_set(); - chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/NuGet.c b/src/recipe/lang/NuGet.c index 2cd0405..bc3ebcb 100644 --- a/src/recipe/lang/NuGet.c +++ b/src/recipe/lang/NuGet.c @@ -8,6 +8,7 @@ void pl_nuget_prelude () { use_this(pl_nuget); + chef_allow_gs(pl_nuget); chef_set_created_on (this, "2023-09-10"); chef_set_last_updated (this, "2025-08-10"); @@ -18,9 +19,6 @@ pl_nuget_prelude () chef_set_sous_chefs (this, 0); chef_set_contributors (this, 0); - chef_allow_get(); - chef_allow_set(); - chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); chef_forbid_user_define(this); diff --git a/src/recipe/lang/OCaml.c b/src/recipe/lang/OCaml.c index 3237b8b..a36ac0b 100644 --- a/src/recipe/lang/OCaml.c +++ b/src/recipe/lang/OCaml.c @@ -8,6 +8,7 @@ void pl_ocaml_prelude () { use_this(pl_ocaml); + chef_allow_gs(pl_ocaml); chef_set_created_on (this, "2023-09-15"); chef_set_last_updated (this, "2025-08-10"); @@ -18,10 +19,6 @@ pl_ocaml_prelude () chef_set_sous_chefs (this, 0); chef_set_contributors (this, 0); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); - chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/PHP.c b/src/recipe/lang/PHP.c index ba6231c..3e322cc 100644 --- a/src/recipe/lang/PHP.c +++ b/src/recipe/lang/PHP.c @@ -8,6 +8,7 @@ void pl_php_prelude () { use_this(pl_php); + chef_allow_gsr(pl_php); chef_set_created_on (this, "2023-08-30"); chef_set_last_updated (this, "2025-08-10"); @@ -18,10 +19,6 @@ pl_php_prelude () chef_set_sous_chefs (this, 0); chef_set_contributors (this, 0); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); - chef_allow_local_mode (this, Can, NULL, NULL); chef_forbid_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/Perl.c b/src/recipe/lang/Perl.c index 90d4d22..ff294f2 100644 --- a/src/recipe/lang/Perl.c +++ b/src/recipe/lang/Perl.c @@ -8,6 +8,7 @@ void pl_perl_prelude () { use_this(pl_perl); + chef_allow_gsr(pl_perl); chef_set_created_on (this, "2023-09-31"); chef_set_last_updated (this, "2025-08-10"); @@ -18,10 +19,6 @@ pl_perl_prelude () chef_set_sous_chefs (this, 0); chef_set_contributors (this, 0); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); - chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/Python/PDM.c b/src/recipe/lang/Python/PDM.c index e8adbc1..f7c088b 100644 --- a/src/recipe/lang/Python/PDM.c +++ b/src/recipe/lang/Python/PDM.c @@ -8,6 +8,7 @@ void pl_python_pdm_prelude (void) { use_this(pl_python_pdm); + chef_allow_gsr(pl_python_pdm); chef_set_created_on (this, "2024-06-05"); chef_set_last_updated (this, "2025-07-11"); @@ -18,10 +19,6 @@ pl_python_pdm_prelude (void) chef_set_sous_chefs (this, 0); chef_set_contributors (this, 0); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); - chef_allow_local_mode (this, FullyCan, "支持项目级配置", "Supports project-level configuration"); chef_allow_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/Python/Poetry.c b/src/recipe/lang/Python/Poetry.c index daebac0..dffcbb5 100644 --- a/src/recipe/lang/Python/Poetry.c +++ b/src/recipe/lang/Python/Poetry.c @@ -8,6 +8,7 @@ void pl_python_poetry_prelude (void) { use_this(pl_python_poetry); + chef_allow_gsr(pl_python_poetry); chef_set_created_on (this, "2024-08-08"); chef_set_last_updated (this, "2025-07-11"); @@ -18,10 +19,6 @@ pl_python_poetry_prelude (void) chef_set_sous_chefs (this, 0); chef_set_contributors (this, 0); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); - chef_allow_local_mode (this, FullyCan, "Poetry 默认使用项目级换源", "Poetry uses project-level source changing by default"); 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 8b658e5..b702c22 100644 --- a/src/recipe/lang/Python/Rye.c +++ b/src/recipe/lang/Python/Rye.c @@ -8,6 +8,7 @@ void pl_python_rye_prelude (void) { use_this(pl_python_rye); + chef_allow_gsr(pl_python_rye); chef_set_created_on (this, "2024-12-06"); chef_set_last_updated (this, "2025-08-09"); @@ -18,10 +19,6 @@ pl_python_rye_prelude (void) chef_set_sous_chefs (this, 0); chef_set_contributors (this, 0); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); - chef_allow_local_mode (this, FullyCan, "支持项目级配置", "Supports project-level configuration"); chef_allow_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/Python/common.h b/src/recipe/lang/Python/common.h index 9b6b784..bcffaf3 100644 --- a/src/recipe/lang/Python/common.h +++ b/src/recipe/lang/Python/common.h @@ -13,7 +13,7 @@ def_target(pl_python_group); static char * pl_python_speed_url_constructor (char *url, char *user_data) { - char *str = xy_str_delete_suffix ("/simple"); + 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"); return str; } diff --git a/src/recipe/lang/Python/pip.c b/src/recipe/lang/Python/pip.c index 1d56a2e..5f68c79 100644 --- a/src/recipe/lang/Python/pip.c +++ b/src/recipe/lang/Python/pip.c @@ -8,6 +8,7 @@ void pl_python_pip_prelude (void) { use_this(pl_python_pip); + chef_allow_gsr(pl_python_pip); chef_set_created_on (this, "2023-09-03"); chef_set_last_updated (this, "2025-07-11"); @@ -18,10 +19,6 @@ pl_python_pip_prelude (void) chef_set_sous_chefs (this, 0); chef_set_contributors (this, 0); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); - chef_forbid_local_mode (this); chef_allow_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/Python/uv.c b/src/recipe/lang/Python/uv.c index 8653d96..3128c12 100644 --- a/src/recipe/lang/Python/uv.c +++ b/src/recipe/lang/Python/uv.c @@ -8,6 +8,7 @@ void pl_python_uv_prelude (void) { use_this(pl_python_uv); + chef_allow_gsr(pl_python_uv); chef_set_created_on (this, "2024-12-11"); chef_set_last_updated (this, "2025-08-09"); @@ -20,10 +21,6 @@ pl_python_uv_prelude (void) "ccy", "icuichengyi@gmail.com", "Aoran Zeng", "ccmywish@qq.com"); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); - chef_allow_local_mode (this, FullyCan, "支持项目级配置", "Supports project-level configuration"); chef_allow_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/R.c b/src/recipe/lang/R.c index abc92f2..8579126 100644 --- a/src/recipe/lang/R.c +++ b/src/recipe/lang/R.c @@ -8,6 +8,7 @@ void pl_r_prelude () { use_this(pl_r); + chef_allow_gs(pl_r); chef_set_created_on (this, "2023-09-21"); chef_set_last_updated (this, "2025-08-10"); @@ -18,10 +19,6 @@ pl_r_prelude () chef_set_sous_chefs (this, 0); chef_set_contributors (this, 0); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); - chef_allow_local_mode (this, CanNot, NULL, NULL); chef_forbid_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/Ruby/Ruby.c b/src/recipe/lang/Ruby/Ruby.c index 6f1ad74..d855861 100644 --- a/src/recipe/lang/Ruby/Ruby.c +++ b/src/recipe/lang/Ruby/Ruby.c @@ -16,6 +16,7 @@ void pl_ruby_prelude (void) { use_this(pl_ruby); + chef_allow_gsr(pl_ruby); chef_set_created_on (this, "2023-08-29"); chef_set_last_updated (this, "2025-07-14"); @@ -26,10 +27,6 @@ pl_ruby_prelude (void) chef_set_sous_chefs (this, 0); chef_set_contributors (this, 0); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); - chef_allow_local_mode (this, PartiallyCan, "Support `bundler`. No support for `gem`", "Support `bundler`. No support for `gem`"); chef_allow_english(this); chef_allow_user_define(this); @@ -76,7 +73,8 @@ pl_ruby_setsrc (char *option) { chsrc_ensure_program ("gem"); - chsrc_yield_source_and_confirm (pl_ruby); + use_this(pl_ruby); + Source_t source = chsrc_yield_source_and_confirm (this, option); char *cmd = NULL; diff --git a/src/recipe/lang/Rust/Cargo.c b/src/recipe/lang/Rust/Cargo.c index ffe3cae..587735c 100644 --- a/src/recipe/lang/Rust/Cargo.c +++ b/src/recipe/lang/Rust/Cargo.c @@ -8,6 +8,7 @@ void pl_rust_cargo_prelude (void) { use_this(pl_rust_cargo); + chef_allow_gsr(pl_rust_cargo); chef_set_created_on (this, "2023-08-30"); chef_set_last_updated (this, "2025-07-22"); @@ -19,9 +20,6 @@ pl_rust_cargo_prelude (void) chef_set_contributors (this, 1, "Mikachu2333", "mikachu.23333@zohomail.com"); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); 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 abcf9f1..68613ad 100644 --- a/src/recipe/lang/Rust/rustup.c +++ b/src/recipe/lang/Rust/rustup.c @@ -11,6 +11,7 @@ void pl_rust_rustup_prelude (void) { use_this(pl_rust_rustup); + chef_allow_gsr(pl_rust_rustup); chef_set_created_on (this, "2024-10-02"); chef_set_last_updated (this, "2025-08-07"); @@ -23,10 +24,6 @@ pl_rust_rustup_prelude (void) "Yangmoooo", "yangmoooo@outlook.com", "Mikachu2333", "mikachu.23333@zohomail.com"); - chef_allow_get(); - chef_allow_set(); - chef_forbid_reset(); - chef_forbid_local_mode (this); chef_forbid_english (this); chef_allow_user_define(this); diff --git a/src/recipe/recipe-template.c b/src/recipe/recipe-template.c index eab3975..9f2d3ea 100644 --- a/src/recipe/recipe-template.c +++ b/src/recipe/recipe-template.c @@ -6,7 +6,7 @@ * Contributors : Nil Null * | * Created On : <2024-08-09> - * Last Modified : <2025-08-09> + * Last Modified : <2025-08-10> * ------------------------------------------------------------- * 本文件作为一个通用模板: * @@ -51,6 +51,10 @@ void __prelude (void) { use_this(_); + chef_allow_gsr(_); + // 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"); @@ -62,9 +66,6 @@ void chef_set_contributors (this, 1, "Nil Null", "nil@null.org"); - chef_allow_get(); - chef_allow_set(); - chef_allow_reset(); chef_allow_local_mode (this, PartiallyCan, "具体说明是否支持项目级换源...", "Tell users the local mode support");