home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_03_01
/
3n01022a
< prev
next >
Wrap
Text File
|
1991-12-05
|
894b
|
21 lines
/* The parameter in the following procedure is S, which is the string
we want to translate. We return the translated characters in S. */
translation (S,main_table,sequential_table)
unsigned char S[]; /* NB: it won't be unsigned by default */
char main_table[]; /* the main 256-byte collation-lookup table */
char sequential_table[]; /* list of 2-byte character codes (if any) */
{
unsigned int i,j,collation_code;
for (i=0; S[i]!='\0'; ++i) {
collation_code=main_table[S[i]];
for (j=0; sequential_table[j]!='\0'; j+=3) {
if (S[i]==sequential_table[j] && S[i+1]==sequential_table[j_1]) {
S[i]=sequential_table[j+2];
break; } }
/* Note: if language is German, put a line here for
translating the eszet (usually code 225) to SS. Note that
results in a size increase. */
S[i]=collation_code; } }