-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
自动参数转化的问题 #4
Comments
之前那种传参方法和现在的传参方式,没有想到好的方法共存,如果需要之前那种,将SHELL_AUTO_PRASE宏改成0就行 |
是不是可以考虑增加一个控制字来处理的这些配置需求? |
输入合法性这个,想不出怎么控制,PC上面的shell也没有对输入合法性做处理的,不过pc是用argc这种方式传参,也是这个shell之前的方式,放在嵌入式用体验不是太好,现在这种方式,参数出问题确实可能造成程序跑飞 |
那我就把自动参数转化做一个封装,作为一个单独的模块,给程序来调用,程序拿到传参后,把参数丢给这个模块,一方面实现参数校验,另外一方面实现参数转换。这个模块就作为shell的一个附加模块来使用。 |
参数检验的难点在于shell无法知道被调用的函数需要的参数类型,参数数量,所以只能根据输入做估计 |
2.0.0版本中,提供了自动参数转化的功能,但启用后,有几个问题:
1、启用后,被调用的函数,无法再获得argc这个参数,也就不知道命令中输入的参数数量是多少,参数输入少了,判断不出来。
2、隐含的最大参数不能超过8个,也在一定程度上隐含的参数的输入顺序。
建议:
1、2.0.0中的自动参数转换,和之前的参数转换能同时提供给用户使用
2、shellExtParsePara()这个函数开放给被调用函数使用
The text was updated successfully, but these errors were encountered: