From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3E98D439CC; Fri, 26 Jan 2024 07:14:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 601F842E21; Fri, 26 Jan 2024 07:14:14 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 333DA402E4 for ; Fri, 26 Jan 2024 07:14:07 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4TLnRv4lvVzsWb8; Fri, 26 Jan 2024 14:12:59 +0800 (CST) Received: from dggpeml500024.china.huawei.com (unknown [7.185.36.10]) by mail.maildlp.com (Postfix) with ESMTPS id DA07A18007A; Fri, 26 Jan 2024 14:14:04 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 26 Jan 2024 14:14:04 +0800 From: Chengwen Feng To: , , , CC: Subject: [PATCH v3 0/8] add argparse library Date: Fri, 26 Jan 2024 06:10:05 +0000 Message-ID: <20240126061013.53608-1-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231121122651.7078-1-fengchengwen@huawei.com> References: <20231121122651.7078-1-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500024.china.huawei.com (7.185.36.10) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Introduce argparse library (which was inspired by the thread [1]), compared with getopt, it makes it easy to write user-friendly command-like program. Note: the 2nd commit contains usage examples. [1] https://patchwork.dpdk.org/project/dpdk/patch/20231105054539.22303-2-fengchengwen@huawei.com/ Chengwen Feng (8): eal: introduce more macro for bit definition argparse: add argparse library argparse: support verify argument config argparse: support parse parameters argparse: provide parsing known type API argparse: support parse unsigned base type argparse: pretty help info examples/dma: replace getopt with argparse --- v3: - Fix argparse_autotest asan fail due to don't free memory. - When a parsing error occurs, display exact parameter name (long_name or short_name). v2: - Refine argparse_lib.rst which address Stephen's comments. - Fix following which address Thomas's comments: 1. Redefine new introduce macros. 2. Squashed the test commit to feature commit. 3. Drop the arguments' defines and direct place in obj. - Use RTE_LOG_LINE marco to impl log. - Update MAINTAINERS file. MAINTAINERS | 5 + app/test/meson.build | 1 + app/test/test_argparse.c | 857 +++++++++++++++++++++++++ doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf.in | 1 + doc/guides/prog_guide/argparse_lib.rst | 185 ++++++ doc/guides/prog_guide/index.rst | 1 + doc/guides/rel_notes/release_24_03.rst | 5 + examples/dma/dmafwd.c | 269 ++++---- examples/dma/meson.build | 2 +- lib/argparse/meson.build | 7 + lib/argparse/rte_argparse.c | 788 +++++++++++++++++++++++ lib/argparse/rte_argparse.h | 217 +++++++ lib/argparse/version.map | 8 + lib/eal/include/rte_bitops.h | 64 ++ lib/meson.build | 1 + 16 files changed, 2258 insertions(+), 154 deletions(-) create mode 100644 app/test/test_argparse.c create mode 100644 doc/guides/prog_guide/argparse_lib.rst create mode 100644 lib/argparse/meson.build create mode 100644 lib/argparse/rte_argparse.c create mode 100644 lib/argparse/rte_argparse.h create mode 100644 lib/argparse/version.map -- 2.17.1