From patchwork Mon Jan 22 03:57:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 570 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E7C8043922; Mon, 22 Jan 2024 05:01:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5DC7F40685; Mon, 22 Jan 2024 05:01:54 +0100 (CET) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mails.dpdk.org (Postfix) with ESMTP id 8AD0E40696 for ; Mon, 22 Jan 2024 05:01:51 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4TJGhQ5Zm7z1gxbG; Mon, 22 Jan 2024 12:00:06 +0800 (CST) Received: from dggpeml500024.china.huawei.com (unknown [7.185.36.10]) by mail.maildlp.com (Postfix) with ESMTPS id DB71714040F; Mon, 22 Jan 2024 12:01:48 +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; Mon, 22 Jan 2024 12:01:48 +0800 From: Chengwen Feng To: , , , CC: Subject: [PATCH 00/12] add argparse library Date: Mon, 22 Jan 2024 03:57:50 +0000 Message-ID: <20240122035802.31491-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 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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 (12): eal: introduce more macro for bit definition argparse: add argparse library argparse: support verify argument config test/argparse: add verify argument config test argparse: support parse parameters test/argparse: add parse parameters test argparse: provide parsing known type API test/argparse: add parse type test argparse: support parse unsigned base type test/argparse: add parse unsigned base type test argparse: pretty help info examples/dma: replace getopt with argparse app/test/meson.build | 1 + app/test/test_argparse.c | 835 +++++++++++++++++++++++++ doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf.in | 1 + doc/guides/prog_guide/argparse_lib.rst | 141 +++++ doc/guides/prog_guide/index.rst | 1 + doc/guides/rel_notes/release_24_03.rst | 5 + examples/dma/dmafwd.c | 279 ++++----- examples/dma/meson.build | 2 +- lib/argparse/meson.build | 7 + lib/argparse/rte_argparse.c | 782 +++++++++++++++++++++++ lib/argparse/rte_argparse.h | 218 +++++++ lib/argparse/version.map | 8 + lib/eal/include/rte_bitops.h | 64 ++ lib/meson.build | 1 + 15 files changed, 2192 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