Previous Topic Next topic Print topic


Evaluate

Use

Evaluates and prints the resultant value of expressions.

Command Syntax

EVALUATE [[/display mode] expression] 
EVALUATE [[/display mode]
         [     /NSDM    |    /NSMF  |  
               /SDM     |    /SMF   | 
               /SM      |    /NSM   | 
               /DM      |    /MF    | 
               /ALL     |    /INTERNAL]
         [     /DERIVED ]
         [     /PRIVATE    | /PUBLIC  | 
               /PROTECTED  |  /ACCESSIBLE ]…

EVALUATE [/STRING c-char-ptr]
EVALUATE [/MACRO c-macro-defn]

where:

display mode
One of ASCII, BIT, FLOAT, HEX, INTEGER, or OCTAL
expression
Can be any expression that may occur in the source language program, including references to simple as well as aggregate (such as array, record, and structure elements) type variables
c-char-ptr
Is a C expression whose resultant type is char *
c-macro-defn
Is a C preprocessor macro definition name

Description

The EVALUATE command evaluates and prints the value of expressions in the source language program. If the expression is omitted, Evaluate uses the previous expression that was evaluated. If no previous expression was evaluated, an error message generates.

The display mode is the mode in which the value of the expression is to be printed. The valid display modes are Ascii, Bit, Float, Hex, Integer, and Octal. The display modes are defined in the table below.

Display
Mode Definition
AScii Displays the value as a series of Ascii characters.
Bit Displays each bit in the value as a 1 or a zero.
Float Displays the value as a single-precision floating-point number.
Hex Displays the value as a series of hexadecimal numbers.
Integer     Displays the value as a series of signed decimal numbers.
Octal Displays the value as a series of unsigned octal numbers.
Note: Codewatch allows evaluation of WIDECHAR variables only. Evaluation of WIDECHAR expressions is currently not supported.

For WIDECHAR variable evaluation, half byte-pairs outside the ASCII range display as a '.' character. Use the EVALUATE command with the /h option to display hexadecimal values for each byte-pair. For example:

dcl wc wchar (16) init('003900370038'Wx);

...

eval wc

WC = .9.7.8. . . . . . . . . . . . .  {widechar (16)}

eval /h wc

WC = 00 39 00 37 00 38 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 (hex)  {widechar (16)}

Example

In this example, the value of data items in the SIFT routine is evaluated.

CodeWatch> EVALUATE THIS_PRIME
THIS_PRIME =         7 {fixed binary (31))

In this example, a cross section of the array PRIMES from 1 to count -1, where count equals 4, is evaluated.

CodeWatch> EVALUATE PRIMES (1 : count - 1)
PRIMES(1) =              1 {fixed binary (31))
PRIMES(2) =              2 {fixed binary (31))
PRIMES(3) =              3 {fixed binary (31))
Previous Topic Next topic Print topic