FORMAT

C Test Script Language

Syntax

FORMAT <variable> = [<new type>[#<display directive> [<size>]]

FORMAT <type> = <new type>[#<display directive> [<size>]]

FORMAT <field> = <new type>[#<display directive> [<size>]]

Description

The FORMAT instruction allows you to modify the type of the tested element, where:

The <new type> is an abstract C type.

The optional <display directive> is one the following suffixes for integers  only:

and with the following possibilities for floating variables:

For integers, <size> is the number of bits to be displayed. For floating variables, <size> is the number of the number of digits after the decimal point.

Associated Rules

The FORMAT statement is optional and must be located after the BEGIN statement.

The FORMAT definition can be replaced by an optional <format> parameter in a VAR statement.

It is applicable immediately, only in the block in which it is declared.

<variable> follows standard C syntax rules. <type> is a C identifier used in typedef, struct or union instructions. <format> is an abstract C type.

If the change is to be applied to array elements, you can use an abstract C type to describe the new modified variable, field, or type.

A format cannot be empty. It must contain either the abstract C type or the display directive.

In the display directive, the size is optional. The size must be a multiple of 8 for the integers. The default values for this size are the following:

Example

#char x;

#char t[10];

FORMAT t = int     -- t is an array of integers

FORMAT x = int#h8  -- display in hexa, only 8 bits

FORMAT y = #b      -- display in binary without modifying the type

FORMAT z = short#u -- display in unsigned decimal

FORMAT f1 = #f     -- displays for example 3.670000

FORMAT f1 = #f4    -- displays for example 3.6700

FORMAT f1 = #e4    -- displays for example 0.36700E1

Related Topics

VAR, ARRAY and STR