This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Calling GEL functions from DSS scripts

Hi all,

I have a query regarding DSS scripting in CCS v4. The DSS scripting Media wiki page says for calling GEL functions from DSS script:

Like with CCScripting, you can call GEL functions from DSS. The expression.evaluate() API can be used to call any GEL function/expression.

// Call GEL function
debugSession.expression.evaluate("myGEL_call()");


Using the above syntax, can I call a user-defined GEL function? or only built-in GEL functions can be called using DSS scripts. How does
a DSS script get to know the fuctions defined in a user made GEL file. What is the procedure of calling user defined GEL functions using
DSS scripting?


Thanks,
Karthik.
  • You can call custom (user-defined) GEL functions using expression.evaluate(). When you load a GEL file that has custom GEL functions, the debugger is aware of them and can be called by DSS. You can then call them just like you would call any built-in GEL function.

    ki

  • Ki-Soo Lee,

    Thanks for your response.

    I tried to call user-defined GEL functions from DSS script, but was not successful in doing so. However, I was successfully able to call in-built GEL functions from DSS script.

    I am getting the error that: The "user defined function" is not defined .i.e it is not able to find the function definition.

    I also tried an other way :

    debugSessionF1A.expression.evaluate("GEL_LoadGel(\"c:\\My_test.gel\")");

    debugSessionF1A.expression.evaluate("test_func()");     // test_func() is defined in My_test.gel file

    But, this too didn't work. The first statement worked, but in the second one, I got an error that test_func() is not defined.

    CCS version used: 4.0.0.16001


    Do you see any problems in the way I am testing?

     

    Thanks,

    Karthik.

  • Karthik Ramana Sankar said:
    debugSessionF1A.expression.evaluate("GEL_LoadGel(\"c:\\My_test.gel\")");

    This would not work. I'm surprised you didn't get an error saying it could not find the GEL file. You need 4 backslashes

    debugSessionF1A.expression.evaluate("GEL_LoadGel(\"c:\\\\My_test.gel\")");

    I just use a forward slash:

    debugSessionF1A.expression.evaluate("GEL_LoadGel(\"c:/My_test.gel\")");

    thanks

    ki

  • Ki-Soo Lee said:
    debugSessionF1A.expression.evaluate("GEL_LoadGel(\"c:/My_test.gel\")");

    Just a quick javascript tip - strings can be declared with single or double quotes.  And within one, you can use the other without escaping.  So can the line above can be simplified just a bit like this?

    debugSessionF1A.expression.evaluate('GEL_LoadGel("c:/My_test.gel")');

    Chris

  • Ki-Soo Lee,

    The exact syntax which I was using for loading the GEL file is:

    debugSessionF1A.expression.evaluate("GEL_LoadGel(\"c:\\CI_summer_intern_files\\Faraday_SRIO_interpreter\\final_faraday_gel\\Faraday_CCS4_Srio_v0.2.gel\")");

    The statement executed successfully without any errors.

    I posted debugSessionF1A.expression.evaluate("GEL_LoadGel(\"c:\\My_test.gel\")"); just for clarity purposes and yes you are right the statement should have been debugSessionF1A.expression.evaluate("GEL_LoadGel(\"c:\\\\My_test.gel\")");


    Thanks,

    Karthik.

  • Thanks Ki-Soo Lee and Chris.

    As Ki had pointed out, it was a problem with loading the GEL file. Now, when I used rhino debugger along with CCS I was able to call user-defined GEL functions from DSS scripts.

     

    Thanks,

    Karthik.