Specifications

4-38
Guide to Printers and Printing
translation table in the ring that can print the character, it prints a substitute character
(underscore) instead.
The following example C language code generates a stage–2 translation table named
XYZ.999, which translates code points from the intermediate code page to code points for
the printers code page. The c1 attribute is assumed to contain the printer command string
that will cause the printer to select code page XYZ.999.
#include <piostruct.h>
#include <fcntl.h>
/*** Table to Translate Code Points for the Intermediate ***/
/*** Code Page to Code Points for a Printer Code Page ***/
struct transtab table[] = {
/* 00 (000) */ {CP}, {CP}, {CP}, {CP},
.
.
.
/* FC (252) */ {63}, {CP}, {94,1}, {SC} };
/*** Command Names for the Translate Table ***/
char cmdnames[][2] = {
{’c’, ’1’}, /* index 0 – select the code page */
{’e’, ’b’} }; /* index 1 – next byte is graphic */
/*** Write the Table To a File (Error Processing Not Shown) ***/
main() {
int fildes;
int num_commands = sizeof(cmdnames) / 2;
fildes = open(”/usr/lib/lpd/pio/trans2/XYZ.999”, O_CREAT |
O_WRONLY,\ 0664);
write(fildes, ”PIOSTAGE2XLATE00”, 16);
write(fildes, &num_commands, sizeof(num_commands));
write(fildes, cmdnames, sizeof(cmdnames));
write(fildes, table, sizeof(table));
return(0);
}
The {63} at code point 252 means that code point 252 should be translated to code point
63 before being sent to the printer. The {CP} at code point 253 means that code point 253
should be sent to the printer with no translation. The {94,1} at code point 254 means that
code point 254 should be translated to code point 94 before it is sent to the printer. The,1
in {94,1} indicates that the printer command string whose 2–character attribute name is
at index 1 in the Command Names array should be sent to the printer before sending the
code point. The SC at code point 255 indicates that the character at code point 255 in the
intermediate code page cannot be printed by the printer code page described by this
stage–2 translation table.