Resource exit

The line-data transform provides an exit that enables you to filter (exclude) resources. This exit is useful in controlling resources at the file-name level. For example, assume you only wanted to use those fonts that are not shipped with InfoPrint Manager. You could code this exit program to contain a table of all fonts shipped with InfoPrint Manager and filter those from the resource file. Security is another consideration for using this exit because you could prevent certain named resources from being included. The program invoked at this exit is defined by the resexitkeyword of the line2afp command.

This exit receives control before a resource is read from a directory. The exit program can request that the resource be processed or ignored (skipped), but it cannot substitute another resource name in place of the requested one. If the exit requests that any overlay be ignored, the line-data transform automatically ignores any resources the overlay might have referenced (that is, fonts and page segments).

Sample resource exit C language header contains a sample C language header that describes the control block that is passed to the exit program.

Sample resource exit C language header

/* RESEXIT STRUCTURE                                                 */
typedef struct _RESEXIT_PARMS /* Parameters for resource record exit */
   char           *work;      /* Address of 16-byte static work area */
   PFATTR         *pfattr;    /* Address of print file attribute info*/
   char           resname[8]; /* Name of requested resource (8 byte) */
   char           restype;    /* Type of resource                    */
   char           request;    /* Ignore or process the resource      */
   char           eof;        /* Last call indicator                 */
   unsigned short resnamel;   /* Length of resource name         @05A*/
   char           pad1[3];    /* padding byte                    @05A*/
   char           resnamf[250]; /* Rsrc name if more than 8 bytes@05A*/

The address of the control block containing these parameters is passed to the resource-record exit:

work (Bytes 1–4)
A pointer to a static, 16-byte memory block. The exit program can use this parameter to save information across calls (for example, pointers to work areas). The 16-byte work area is aligned on a full word boundary and is initialized to binary zeros before the first call. A user-written exit program must provide the code required to manage this work area.
pfattr (Bytes 5–8)
A pointer to the print file attribute data structure. See Attributes of the line-data input file for more information about the format of this data structure and the information presented.
resname (Bytes 9–16)
Specifies the name of the requested resource. The exit program cannot modify or change this value.
restype (Byte 17)
Specifies the type of resource the name refers to. This is a one-byte hexadecimal value where:
Specifies a GOCA (graphics) object
Specifies a BCOCA (barcode) object
Specifies an IOCA (IO image) object
Specifies a font character set
Specifies a code page
Specifies a page segment
Specifies an overlay

The line-data transform does not call this exit for these resource types:

  • Page definition

    The page definition (pagedef keyword) is a required resource for transforming a line-data file.

  • Form definition

    The form definition (formdef keyword) is a required resource for printing a transformed line-data file.

  • Coded fonts

    The line-data transform must process coded fonts to determine the names of the code pages and font character sets they reference. This is necessary in creating Map Coded Font-2 (MCF-2) structured fields.

request (Byte 18)
Specifies how the line-data transform processes the resource. On entry to the exit program, this parameter is X'00'. When the exit program returns control to the line-data transform, this parameter must have the value X'00' or X'01' where:
Specifies that the line-data transform should process the resource.
Specifies that the line-data transform should ignore the resource.

A value of X'00' on entry to the exit program specifies that the resource be processed. If you want to ignore the resource, change the request byte value to X'01'. Any value greater than X'01' is interpreted as X'00' and the resource is processed.

Specifies the length of the meaningful characters in the resnamef field.