Documentation:Users:TDI:DecompileAction - MdsWiki
Navigation
Personal tools

From MdsWiki

Jump to: navigation, search

In the following it is described how to get the TDI expression from an existing action node (or how an action node is decompiled). The general DECOMPILE entry from the TDI reference list is [here].

Let's start with the "solution" - here is an example in IDL:

IDL> mdsopen,'particles',-1
IDL> tdistring = mdsvalue('decompile(`getnci(\en_h412_01:init_action,"record"))')
IDL> print,tdistring

Build_Action(Build_Dispatch(2, "luna::gka2_server", "INIT", 50, ""),
Build_Method(*, "INIT", \EN_H412_01), "")

Please note the single backquote character in front of the getnci(...)!

It is not possible to simply read and print the action node with

print,mdsvalue('\en_h412_01:init_action')

This would lead to a type mismatch error. It is necessary to DECOMPILE the content of the node.

The decompile function will decompile the data structure passed as an argument. If you were to simply use:

  mdsvalue('decompile(\en_h412_01:init_action)')

you would get back a string of the node name. If you used:

  mdsvalue('decompile(getnci(\en_h412_01:init_action,"record"))')

MDSplus would first compile the getnci(....) into a call structure and the subsequent decompile would just return the string 'getnci(...)'. Therefor you have to use the trick with the single backquote character. This tells MDSplus do evaluate the expression to the right of the backquote when it is compiling the expression. This results in decompile being called with the contents of the node (the evaluation of the getnci() function call) which is exactly what we want.
To summarise the syntax in IDL:

action_string = mdsvalue('decompile(`getnci(action_node,"record"))')