Using the _eval() Function

The _eval() function evaluates a string as an expression of the function. This function uses the following format:

_eval(expression [,tracemsg [,level]])

Property

Type

Description

expression

string

The string to be evaluated.

tracemsg

string

A trace message to be issued when the expression is evaluated.

level

keyword

The trace level specified for the tracemsg attribute. The following trace levels are supported:

  • none. Does not return any traces.
  • error. This setting provides error level traces.
  • debug. This setting provides debug level traces (default).
  • deep. This setting provides deep level traces.

A common use of the _eval() function is to store a complex expression in a file. The expression can be used by _eval(_file(<path>)). Assume that the file /myfilescfg.txt contains the simple expression _sreg('iway.config','none'). If the _file('/myfilescfg.txt') function is used alone, then the value will be _sreg('iway.config','none'), the value in the file. However, by using the _eval() function, the _sreg() is evaluated and the result is the name of the configuration in which the server is running.

An optional tracing service adds a message at the specified trace level (if enabled) to the current trace log. This is useful for debugging the value to be output by this function. By including the special token (%v) in the trace message, the expression value can be included in the message. For example:

_eval('file(/holdifl.txt)','eval got %v','deep')

iWay Software