The libddpi design recognizes that output data
will include the names and values of variables, types and functions. The Ddpi_Format specifiers
handle this type of information.
Description
For example:
- The %<NV> specifier indicates that a variable name
should be sent to output.
- The %<I> specifier indicates that an indentation
should be added, based on the nested position of the given data.
Composite-type data can be extracted for an entire structure or for a
single member. For example, if the
ddpi_formatter operation
specifies
%<Nd> , the function will return both the tag
name and the variable name of the given composite variable.
Specifiers that identify output data
- %<NT>
- %<NT> causes the function to return the type of the
variable.
- %<NV>
- %<NV> causes the function to return the name of the
variable.
- %<Nd>
- %<Nd> causes the function to return both the type
and name of the variable.
- %<ND>
- %<ND> behaves the same as %<Nd>,
except that the composite types are expanded. For example, if a structure
is used, then the function will also return the type and name of the members.
- %<V>
- %<V> causes the function to return the value of the
variable.
Specifiers that format output data
- %<Ix>
- Causes the function to create an indentation, where x is
the depth in the current nested level of a composite type. For example, %<I3> will
cause an indentation of three spaces per level. For a member of a structure
inside a structure, the indentation would be six spaces.
- %<S>
- Causes the function to print a string that is enclosed in double quotes,
and replace non-printable characters with dots.
- %<C>
- Causes the function to print a character enclosed in single quotes. It
replaces control characters, based on the input character set (EBCDIC or ASCII),
as shown in Table 1.
It replaces other non-printing characters with dots.
- user defined
- The format specifier also accepts the general syntax %<fmt_name> ,
where fmt_name is a symbolic name representing a format string. fmt_name must
be defined by a previous call to the ddpi_format_set_type_format operation.
Substitution is done recursively until all items with the %<...> syntax
are replaced.
- Example: If you want to replace all occurrences of %<UINT> in
the given format string with %12.12u, use the following statement:
ddpi_format_set_type_format(info, "UINT", "%12.12u");