]>
git.saurik.com Git - wxWidgets.git/blob - misc/unictabl/mk_ctable.c
12 int cmpt(const void *i1
, const void *i2
)
14 unsigned short u1
= ((charsetItem
*)i1
) -> u
;
15 unsigned short u2
= ((charsetItem
*)i2
) -> u
;
21 int main(int argc
, char *argv
[])
25 charsetItem table
[256];
27 for (i
= 0; i
< 256; i
++) { table
[i
].c
= i
, table
[i
].u
= 0; /* unknown */}
31 scanf("%i\t%i\n", &enc
, &unic
);
34 if (enc
< 128 && enc
!= unic
)
35 fprintf(stderr
, "7bit ASCII incompatibilit (%s): %i->%i\n",
43 " * %s to Unicode recoding table\n"
44 " * based on file %s by Unicode Consortium\n"
46 "static const wxUint16 encoding_table__%s[128] = {",
47 argv
[2], argv
[1], argv
[2]);
49 for (i
= 128; i
< 256; i
++)
53 printf(" 0x%04X%c", table
[i
].u
, (i
== 255) ? '\n' : ',');
57 qsort(table
+ 128, 128, sizeof(table
[0]), cmpt
);
61 NO, WE DON'T NEED REVERSE TABLE, WE CAN BUILD IT AT RUNTIME
62 (won't take that much time, after all you don't init
63 conversion so often...)
66 "static wxUint16 encoding_table_rev__%s[128] = {",
69 for (i = 128; i < 256; i++)
73 printf("{c:0x%02X,u:0x%04X}%c ", table[i].c, table[i].u, (i == 255) ? '\n' : ',');