Skip to content

tests/gnrc_udp: reimplement using sys/optparse.#11400

Closed
jcarrano wants to merge 20 commits intoRIOT-OS:masterfrom
jcarrano:optparse-example
Closed

tests/gnrc_udp: reimplement using sys/optparse.#11400
jcarrano wants to merge 20 commits intoRIOT-OS:masterfrom
jcarrano:optparse-example

Conversation

@jcarrano
Copy link
Copy Markdown
Contributor

Contribution description

Some time ago I wrote #9538 but it was lacking an example of how it can be used. Now, inspired by #11357 , I present the "optparse version" of tests/gnrc_udp.

For more information, see #9538

Testing procedure1

The module is tested in the original PR. The goal of this is just to show how code looks like when it uses sys/optparse.

Issues/PRs references

Depends on #9538.

jcarrano added 20 commits April 12, 2019 19:13
Add a generic command line parser that can be used by shell commands.

This is **NOT** getopt.
- Turn macros into functions
- Use DEVELHELP instead of DEBUG
- Use typedefs.
- Add some more comments.
The previous code wuld not accept constant argv.
LOAD_VAR renamed to LAZY_LOAD (because it loads lazily)
Moved variable declarations closer to where they are used.
Unnecessary for microcontrollers, many will not even have support for
it. Also saves space in the opt_rule_t structure (it was the only
8 byte member).
The handling of positional arguments was completely reworked.

Also, the command line format can now be completely specified in
read-only memory and initialized via static macros.
These changes produce a small but noticeable decrease in code size.
Show how optparse can be used in an existing code.
Parsers are not for validation. They are for parsing.
@jcarrano jcarrano added Area: tests Area: tests and testing framework Type: new feature The issue requests / The PR implemements a new feature for RIOT State: waiting for other PR State: The PR requires another PR to be merged first State: demonstrator State: This PR (loosely) demonstrates a concept and is not necessarily meant to be merged. labels Apr 15, 2019
@MrKevinWeiss MrKevinWeiss added this to the Release 2021.07 milestone Jun 21, 2021
@MrKevinWeiss MrKevinWeiss removed this from the Release 2021.07 milestone Jul 15, 2021
@Teufelchen1
Copy link
Copy Markdown
Contributor

Since the dependency PR got closed, do you think this PR should also be closed?

@Teufelchen1
Copy link
Copy Markdown
Contributor

Teufelchen1 commented Mar 12, 2024

I think this is a yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: tests Area: tests and testing framework State: demonstrator State: This PR (loosely) demonstrates a concept and is not necessarily meant to be merged. State: waiting for other PR State: The PR requires another PR to be merged first Type: new feature The issue requests / The PR implemements a new feature for RIOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants