User`s guide
4-31
Printer, Plotter, and Spooler Subsystem Programming
Message Format
Each message sent by the printer backend consists of a message header frame, zero or
more parameter header frames, a fully expanded message, and text consisting of zero or
more parameters. The message header specifies the message type, message catalog
information, length of expanded message text, and the number of variable message
parameters. The variable message parameters are used to build the expanded message
text from the basic message text that is extracted from the message catalog. The structure
formats for the message header and the message parameter header frames are defined in
the /usr/include/piostruct.h file.
When extracting messages from the pipe, the print supervisor reads the message header
frame, then reads the message parameter header frames (0–9, as specified by the number
of parameters specified in the message header frame). The print supervisor reads the
expanded message text, the length of which is specified in the message header frame,
followed by the parameters (if any). The type and length of any parameters are specified in
the individual message parameter header frames.
The type of message is specified in the message header frame. The two message types
are:
• ID_VAL_EVENT_ABORTED_BY_SERVER
• ID_VAL_EVENT_WARNING_RESOURCE_NEEDS_ATTENTION
The actual message text is in expanded format. The parameters are placed in the message
text after the parameters are extracted from the message catalog file in the server’s locale.
The print supervisor can use the message text or build its own message text from the
supplied message catalog information and the message parameters. However, the printer
backend cannot provide message catalog information (message number, set number, and
catalog name) and variable message parameters in all cases. Therefore, the print
supervisor must check for the catalog name field (pm_catnm field) to determine if the
catalog name is a null string. If the catalog name is a null string, the print supervisor must
use the supplied expanded message text.
If a catalog name is provided, the print supervisor can extract the message from the catalog
and place any supplied message parameters in the message. The message parameters
can be integer or string type. However, message parameters are passed from the printer
backend as strings concatenated to the expanded message text. If the print supervisor
extracts the message from the specified catalog and places the parameters in the message,
the following conventions apply:
• Parameters can be integer or string type, but are always passed in the pipe as strings
with a trailing NUL character. The length of each parameter in string format is supplied in
the parameter’s associated header frame.
• Extracted messages can contain escape sequences recognized by the printf subroutine.
Therefore, while populating the message, the print supervisor checks for escape
sequences such as %s , %d , and %c , and converts the parameters accordingly.
Positional parameters are sometimes specified by using %n$s or %n$d . In such cases,
the print supervisor fills in the parameters in the specified order.
• A maximum of nine parameters can be specified. Therefore, the print supervisor can use
nine variables of *char type and assign the variables to the appropriate supplied
parameter strings. After replacing all positional specifiers and integer specifiers, the
parameters can be passed to the printf subroutine. For example, the extracted message
text might contain the following:
Error %8$d in opening %6$s file
The print supervisor converts the message to the following:
Error %s in opening %s file