AMcTools Forum 
Pages: 1
Send Topic Print
Variable number of parameters (Read 2859 times)
YaBB Newbies

I Love YaBB 2!

Posts: 12
Gender: male
Variable number of parameters
01/16/10 at 11:28:46
This is feature request.
Currently there is GETPARAM(n) which return double.

Is possible to add GETPARAMCOUNT() which return int as count of parameters entered in project?
I'd like use this to have some parameters only optional.

Is possible to add string parameters and something like GETPARAM_As_String(n) which return "const char *"?
In project this must be entered in parenthesis (""), and distinguished by them, so use e.g.:
Xtest _component(0.1 "file.log" 0.2) PA0 PA1
So it have three parameters: double,string,double
Calling GETPARAM on string parameter gets error and/or return 0. The same calling GETPARAM_As_String on double parametr gets error and/or return NULL.

Another idea - and only idea, not request:
What about entering parameters by name?
E.g.: Xtest _component(speed=0.1 logfile="file.log" repeat=0.2) PA0 PA1     and then asking them by GETPARAM("speed")
And maybe the same for pins ;-)
Xtest _component(speed=0.1 logfile="file.log" repeat=0.2) input=PA0 output=PA1
This will be much more to write, but can be self-documenting.

Back to top
  IP Logged
YaBB Administrator

I love forums, don't

Posts: 308
AMcTools (Spain)
Gender: male
Re: Variable number of parameters
Reply #1 - 01/16/10 at 17:05:28

About your first request, it is DONE!  there is a new interpretation of the zero value: GET_PARAM(0), which returns the number of paramers. This was also requested by "thVortex" and it is already functional.

For passing a string as parameters I suggest you to do it throug the GET_INSTANCE(), so

Xmy_instance _mysutff(...) ....

GET_INSTANCE() will return "my_instance", so you can use it for files, etc.  It is not perfect (only one string...) but it works.

Please, wait a few days, and I'll give you instructions in a private message about how to download a private release implementing this and some other fixes.

Private, intermediate releases, are only available to collaborators showing an active development / testing / reporting activity.

Back to top
WWW   IP Logged
Pages: 1
Send Topic Print