Programming Guide



sm_xlate_table

Installs or deinstalls an 8-bit character translation table

char *sm_xlate_table(int which, char *new);

which
Determines whether the table is for keyboard input or screen output through arguments of XLATE_INPUT or XLATE_OUTPUT.

new
The name of the new translation table, where new can hold at least 256 bytes. Be sure to allocate permanent memory to hold the table data.

Environment

C only

Returns

Description

sm_xlate_table installs the translation table pointed to by new. To deinstall and deactivate translation, supply a value of NULL for new.

Example

/********************************************************/
/* The following example translates, on keyboard input, */
/* all vowels to the letter 'a'. */
/********************************************************/

static char working_buf[256];

int
install_xlate_table ()
{
int i;

for (i = 0x00; i <= 0xff; i++)
working_buf[i] = i;

working_buf[0x65] = 0x61; /* change 'e' to 'a' */
working_buf[0x69] = 0x61; /* change 'i' to 'a' */
working_buf[0x6f] = 0x61; /* change 'o' to 'a' */
working_buf[0x75] = 0x61; /* change 'u' to 'a' */

sm_xlate_table (XLATE_INPUT, working_buf);

return (0);
}