Documentation:dt ident - MdsWiki
Navigation
Personal tools

From MdsWiki

Jump to: navigation, search

Ident Data Type

MDSplus expressions can contain private and public variables (often called "Ken Variables" after the person that implemented most of TDI, Ken Klare). When an expression is compiled containing these variables, the reference to the variable is stored as an DTYPE_IDENT distinguishing the name from a node reference or a text string. When an expression containing variable references are evaluated, the current contents of the variable is substituted for this reference.

Care should be taken to not store variable references as data in nodes or return them in TDI function unless they are guaranteed to be correctly defined when the expression is evaluated. The MAKE_structure built-in functions are provided to ensure that the variables are dereferenced. For example, if your TDI function looked something like:

INCORRECT!


Public Fun MYFUN(IN _X, IN _Y)
{
  return(BUILD_SIGNAL(_Y,*,_X));
}

You would get unexpected results. In this case when you try to plot the signal returned, you would get the current contents of the private variables _X and _Y if they are defined at all and not necessarily the values passed into the function. To avoid this you would use the MAKE_SIGNAL function instead of the BUILD_SIGNAL function. The MAKE_SIGNAL function replaces any of its arguments that are Identifiers with the contents of that identifier.

CORRECT!


Public Fun MYFUN(IN _X, IN _Y)
{
  return(MAKE_SIGNAL(_Y,*,_X));
}

The following table lists some of the functions used to create or access the ident datatype:

Function Description
ALLOCATED Test if variable is currently defined
DEALLOCATE Release variable
EQUALS [=] Load variable
MAKE_ACTION Make an action structure
MAKE_CALL Make a call structure
MAKE_CONDITION Make a condition structure
MAKE_CONGLOM Make a conglomerate structure
MAKE_DEPENDENCY Make a dependency structure
MAKE_DIM Make a dimension structure
MAKE_DISPATCH Make a dispatch structure
MAKE_FUNCTION Make a function structure
MAKE_METHOD Make a method structure
MAKE_PARAM Make a parameter structure
MAKE_PROCEDURE Make a procedure structure
MAKE_PROGRAM Make a program structure
MAKE_RANGE Make a range structure
MAKE_ROUTINE Make a routine structure
MAKE_SIGNAL Make a signal structure
MAKE_SLOPE Make a slope structure
MAKE_WINDOW Make a window structure
MAKE_WITH_ERROR Make a with_error structure
MAKE_WITH_UNITS Make a with_units structure
RESET_PRIVATE Deassign private variables and functions
RESET_PUBLIC Deassign public variables and functions
SHOW_PRIVATE List private variables and functions
SHOW_PUBLIC List public variables and functions
VAR Define or reference variable