From babc73af382ad88a7992acbd94c2ba2661e723cf Mon Sep 17 00:00:00 2001 From: "Gary.Zhang" Date: Thu, 9 Apr 2026 21:48:30 +0800 Subject: [PATCH 1/2] upload for dict module --- tools/Kconfig | 1 + tools/dict/Kconfig | 52 +++++++++++++++++++++++++++++++++++++++++ tools/dict/package.json | 28 ++++++++++++++++++++++ tools/sorch/Kconfig | 2 ++ 4 files changed, 83 insertions(+) create mode 100644 tools/dict/Kconfig create mode 100644 tools/dict/package.json diff --git a/tools/Kconfig b/tools/Kconfig index 3f1acf7a5d..6a61921d0d 100644 --- a/tools/Kconfig +++ b/tools/Kconfig @@ -2,6 +2,7 @@ menu "tools packages" source "$PKGS_DIR/packages/tools/vector/Kconfig" source "$PKGS_DIR/packages/tools/sorch/Kconfig" +source "$PKGS_DIR/packages/tools/dict/Kconfig" source "$PKGS_DIR/packages/tools/CmBacktrace/Kconfig" source "$PKGS_DIR/packages/tools/MCoreDump/Kconfig" source "$PKGS_DIR/packages/tools/EasyFlash/Kconfig" diff --git a/tools/dict/Kconfig b/tools/dict/Kconfig new file mode 100644 index 0000000000..dffc73e184 --- /dev/null +++ b/tools/dict/Kconfig @@ -0,0 +1,52 @@ +# Kconfig for package dict +menuconfig PKG_USING_DICT + bool "dict: a general-purpose dictionary module" + default n + +if PKG_USING_DICT + config PKG_DICT_PATH + string + default "/packages/tools/dict" + + config DICT_DEFAULT_CAPACITY + int "Default initial capacity" + default 32 + range 8 65536 + help + Set the default bucket array capacity when creating a dictionary + without specifying a configuration. Recommended values: 16/32/64. + Higher values reduce resize operations but consume more memory. + + + config DICT_LOAD_FACTOR + int "Load factor (x100)" + default 75 + range 50 95 + help + Set the resize threshold as a percentage of capacity. + When element count >= capacity * (load_factor/100), the dictionary + automatically expands to prevent excessive hash collisions. + + Common values: + - 50: Lower memory usage, more resize operations + - 75: Balanced (default) + - 90: Higher memory usage, fewer resize operations + + choice + prompt "Version" + default PKG_USING_DICT_LATEST_VERSION + help + Select the package version + + config PKG_USING_DICT_LATEST_VERSION + bool "latest" + + endchoice + + config PKG_DICT_VER + string + default "latest" if PKG_USING_DICT_LATEST_VERSION + +endif + + diff --git a/tools/dict/package.json b/tools/dict/package.json new file mode 100644 index 0000000000..2f44ad1696 --- /dev/null +++ b/tools/dict/package.json @@ -0,0 +1,28 @@ +{ + "name": "dict", + "description": "dict is a general-purpose dictionary module", + "description_zh": "dict 是一个为 RT-Thread 设计的通用字典模块,支持任意数据类型的键值对存取", + "enable": "PKG_USING_DICT", + "keywords": [ + "dict", "dictionary", "key-value pairs" + ], + "category": "tools", + "author": { + "name": "zhangguofu", + "email": "cleancode@163.com", + "github": "Gary.Zhang" + }, + "license": "MIT", + "repository": "https://github.com/zhangguofu/dict", + "icon": "unknown", + "homepage": "https://github.com/zhangguofu/dict#readme", + "doc": "unknown", + "site": [ + { + "version": "latest", + "URL": "https://github.com/zhangguofu/dict.git", + "filename": "dict.zip", + "VER_SHA": "main" + } + ] +} diff --git a/tools/sorch/Kconfig b/tools/sorch/Kconfig index a282d39ff3..685ef8ba84 100644 --- a/tools/sorch/Kconfig +++ b/tools/sorch/Kconfig @@ -24,3 +24,5 @@ if PKG_USING_SORCH default "latest" if PKG_USING_SORCH_LATEST_VERSION endif + + From 5c45736dc316f435a4756e7ee238444337085448 Mon Sep 17 00:00:00 2001 From: "Gary.Zhang" Date: Fri, 10 Apr 2026 11:18:48 +0800 Subject: [PATCH 2/2] fix compile option redefinition issue --- tools/dict/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/dict/Kconfig b/tools/dict/Kconfig index dffc73e184..97e34ba4a7 100644 --- a/tools/dict/Kconfig +++ b/tools/dict/Kconfig @@ -18,7 +18,7 @@ if PKG_USING_DICT Higher values reduce resize operations but consume more memory. - config DICT_LOAD_FACTOR + config DICT_LOAD_FACTOR_X100 int "Load factor (x100)" default 75 range 50 95