Specifications
4-41
Printer, Plotter, and Spooler Subsystem Programming
Translation Table Example
#include <fcntl.h>
struct trans_table /*Translation Table Structure */
{
unsigned int reserv1; /* Reserved */
unsigned int f_cp; /* From code point */
unsigned int reserv2; /* Reserved */
unsigned int t_cp; /* To code point */
};
/*
*Table to translate code points for input code set(NewCodeSet)
*to code points for the process code set(IBM–943).
*/
struct trans_table table[] =
{
{0x0,0x81ca,0x0,0xfa54},{0x0,0x9e77,0x0,0x954f},\
{0x0,0x9e8d,0x0,0x938e},
/* .... */
[0x0,0xfad0,0x0,0x8d56}
};
/* Write the table. Error processing not shown. */
main()
{
int ftrans;
long hdsize = 32; /* Header size */
long cpsize = 4; /* Code point size */
long rsv1 = 0, rsv2 = 0; /* Reserved area */
ftrans = open(”usr/lib/lpd/pio/transJP/newcodeset_IBM–932”,
O_CREAT | O_WRONLY, 0664);
write(ftrans, ”PIOSMBCSXLATE000”, 16);
write(ftrans, &hdsize, sizeof(long));
write(ftrans, &cpsize, sizeof(long));
write(ftrans, &rsv1, sizeof(long));
write(ftrans, &rsv2, sizeof(long));
write(ftrans, table, sizeof(table));
return(0);
}