getUiFunctionList(). Is there a function to return all possible function names

Find and share HowTos to various installations / configurations!
7 posts • Page 1 of 1
fmulder
Posts:330
Joined: Wed Feb 03, 2010 9:46 am

getUiFunctionList(). Is there a function to return all possible function names

Post by fmulder »

getUiFunctionList() will return the names of the standard(!) functions that are available in an UI. Unfortunately, this will not give me the names of the functions that we developed by ourselves.

Is there a way to get a list of functions defined in any of our own script libraries ? Goal is to make a panel that will be used to do automated tested. I want to show a drop-down box with our own defined functions and then want to call the function and automatically verify its results.

Note that getUiFunctionList() will show you the function and its arguments. This is perfect for for the automated testing !

Thanks

Frenk Mulder
Share the fun !

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: getUiFunctionList(). Is there a function to return all possible function names

Post by mkoller »

There's no such function in CTRL. But you can create one in a Ctrl extension.
It's basically the following:

Code: Select all

... loop over all your script files ...

    CharString source;
    if ( !CtrlCB::fileToString(path + fileName, source) )
      continue;

    CtrlScript *script = new CtrlScript(new CtrlFileExtData(fileName), PVSS_TRUE);
    if ( !Controller::parseScriptRelaxed(source, *script) )
    {
      delete script;
      continue;
    }

    for (const CtrlFunc *func = script->getCtrlFuncs(); func; func = func->getNext())
    {
      // build signature of function
      CharString tooltip = func->signature();
      ... 
    }

  delete script;

fmulder
Posts:330
Joined: Wed Feb 03, 2010 9:46 am

Re: getUiFunctionList(). Is there a function to return all possible function names

Post by fmulder »

This is fantastic and exactly what i was looking for.
(And a chance to work on a control DLL again)

Thanks Martin

Share the Fun
Frenk Mulder

fmulder
Posts:330
Joined: Wed Feb 03, 2010 9:46 am

Re: getUiFunctionList(). Is there a function to return all possible function names

Post by fmulder »

It worked. Thanks Martin

Have a good weekend

Share the fun
Frenk Mulder

fmulder
Posts:330
Joined: Wed Feb 03, 2010 9:46 am

Re: getUiFunctionList(). Is there a function to return all possible function names

Post by fmulder »

Martin,

How can I found wether a function is 'private' ?

Also, when I have a function that looks like : private dyn_int MyFirstFunction( dyn_string strArgument = makeDynString() );
Then the 'tooltip' will only say: dyn_int MyFirstFunction( dyn_string strArgument = );

Is there a way to get:
- the indication private
- the default value (makeDynString() )

Thanks

Frenk Mulder

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: getUiFunctionList(). Is there a function to return all possible function names

Post by mkoller »

- Just use CtrlFunc::isPrivate()
- for the initializer, it should work to iterate over the CtrlFunc::getParamList() and call CtrlVar::getInitializer()->toString() (I need to fix that in CtrlFunc::signature(). Thanks for spotting)

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: getUiFunctionList(). Is there a function to return all possible function names

Post by mkoller »

The initializer is not that trivial as I first thought since an initializer expression can be more complex
(e.g. assume rand() + 2 + rand() * 7)

7 posts • Page 1 of 1