home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / k95source / ckouni.h < prev    next >
C/C++ Source or Header  |  2020-01-01  |  8KB  |  251 lines

  1. /*  C K O U N I . H  --  Unicode/Terminal character-set translations  */
  2.  
  3. /*
  4.   Copyright (C) 1985, 1999, Trustees of Columbia University in the City of New
  5.   York.
  6.  
  7.   Authors:
  8.     Frank da Cruz <fdc@columbia.edu>
  9.     Jeffrey Altman <jaltman@columbia.edu>
  10.     The Kermit Project, Columbia University, New York City.
  11. */
  12.  
  13. /* Terminal character sets */
  14.  
  15. #ifndef CKOUNI_H
  16. #define CKOUNI_H
  17. #define CKOUNI                 /* Use UNICODE for OS/2 functions */
  18. #ifdef KUI
  19. #define X_CKOUNI_IN            /* Use Unicode Input */
  20. #define CKOUNI_OUT
  21. #endif /* KUI */
  22.  
  23. /* Terminal Character Sets */
  24.  
  25. #define TX_ASCII        0        /* US ASCII */
  26. #define TX_BRITISH    1        /* British ISO 646 */
  27. #define TX_CN_FRENCH    2        /* Canadian French NRC */
  28. #define TX_CUBAN    3        /* Cuba */
  29. #define TX_CZECH    4        /* Czech Republic */
  30. #define TX_DANISH    5        /* Denmark / Norway ISO 646 */
  31. #define TX_DUTCH    6        /* Dutch NRC */
  32. #define TX_FINNISH    7        /* Finnish NRC */
  33. #define TX_FRENCH    8        /* French ISO 646 */
  34. #define TX_GERMAN    9        /* German ISO 646 */
  35. #define TX_HE7           10        /* Hebrew 7 (DEC) */
  36. #define TX_HUNGARIAN   11        /* Hungarian ISO 646 */
  37. #define TX_ICELANDIC   12        /* Icelandic NRC */
  38. #define TX_ITALIAN     13        /* Italian ISO 646 */
  39. #define TX_J201R       14        /* JIS 0201 Japanese Roman */
  40. #define TX_J201K       15        /* JIS 0201 Katakana */
  41. #define TX_KOI7           16        /* Short KOI */
  42. #define TX_NORWEGIAN   17        /* Denmark / Norway ISO 646 */
  43. #define TX_PORTUGUESE  18        /* Portuguese ISO 646 */
  44. #define TX_SPANISH     19        /* Spanish ISO 646 */
  45. #define TX_SWEDISH     20        /* Swedish ISO 646 */
  46. #define TX_SWE_2       21        /* Swedish for names ISO 646 */
  47. #define TX_SWISS       22        /* Swiss NRC */
  48. #define TX_8859_1      23        /* Latin-1 */
  49. #define TX_8859_2      24        /* Latin-2 */
  50. #define TX_8859_3      25        /* Latin-3 */
  51. #define TX_8859_4      26        /* Latin-4 */
  52. #define TX_8859_5      27        /* Latin/Cyrillic */
  53. #define TX_8859_6      28        /* Latin/Arabic */
  54. #define TX_8859_7      29        /* Latin/Greek */
  55. #define TX_8859_8      30        /* Latin/Hebrew */
  56. #define TX_8859_9      31        /* Latin-5 */
  57. #define TX_8859_10     32        /* Latin-6 */
  58.  
  59. #define TX_KOI8           33        /* GOST 19768-74 KOI-8 */
  60.  
  61. #define TX_JIS7           34        /* JIS-7 */
  62. #define TX_SHJIS       35        /* Shift JIS */
  63. #define TX_JEUC           36        /* Japanese EUC */
  64. #define TX_JDEC           37        /* Japanese DEC Kanji */
  65.  
  66. #define TX_DECMCS      38        /* DEC MCS */
  67. #define TX_NEXT           39        /* NeXT */
  68. #define TX_DGI           40        /* Data General International */
  69. #define TX_MACL1       41        /* Macintosh Latin-1 */
  70. #define TX_HPR8           42        /* HP Roman 8 */
  71.  
  72. /* Code pages */
  73.  
  74. #define TX_CP437       43        /* Original */
  75. #define TX_CP850       44        /* Multinational (Western Europe) */
  76. #define TX_CP852       45        /* Eastern Europe */
  77. #define TX_CP857       46        /* Turkey */
  78. #define TX_CP862       47        /* Hebrew */
  79. #define TX_CP864       48        /* Arabic */
  80. #define TX_CP866       49        /* Cyrillic */
  81. #define TX_CP869       50        /* Greek */
  82.  
  83. #define TX_DECSPEC     51        /* DEC Special Graphics */
  84. #define TX_DECTECH     52        /* DEC Technical */
  85. #define TX_C0PICT      53               /* C0 Display Controls */
  86. #define TX_C1PICT      54               /* C1 Display Controls */
  87. #define TX_IBMC0GRPH   55               /* IBM C0 Graphics (smileys) */
  88. #define TX_H19GRAPH    56        /* Heath/Zenith 19 Graphics */
  89. #define TX_TVIGRAPH    57        /* Televideo Graphics */
  90. #define TX_WYSE60G_N   58        /* Wyse 60 Native Mode Graphics */
  91. #define TX_WYSE60G_1   59        /* Wyse 60 Graphics 1 */
  92. #define TX_WYSE60G_2   60        /* Wyse 60 Graphics 2 */
  93. #define TX_WYSE60G_3   61        /* Wyse 60 Graphics 3 */
  94.  
  95. /* New ones that came too late for the nice grouping... */
  96.  
  97. #define TX_ELOT927     62        /* Greek ELOT 927 */
  98. #define TX_DGPCGRPH    63        /* DG PC Graphics */
  99. #define TX_DGLDGRPH    64        /* DG Line Drawing Graphics */
  100. #define TX_DGWPGRPH    65        /* DG Word Processing (etc) Graphics */
  101. #define TX_HPLINE      66        /* HP Line Drawing */
  102. #define TX_HPMATH      67        /* HP Math/Technical */
  103. #define TX_QNXGRPH     68        /* QNX Graphics */
  104.  
  105. /* Siemens Nixdorf character sets */
  106.  
  107. #define TX_SNIBRACK    69        /* SNI 97801 Brackets */
  108. #define TX_SNIEURO     70        /* SNI 97801 Euro  */
  109. #define TX_SNIFACET    71        /* SNI 97801 Facet */
  110. #define TX_SNIIBM      72        /* SNI 97801 "IBM" */
  111. #define TX_SNIBLANK    73               /* SNI 97801 Blanks */
  112.  
  113. /* Windows Code pages */
  114.  
  115. #define TX_CP1252      74        /* Latin-1 Windows */
  116. #define TX_CP1250      75        /* Latin-2 Windows */
  117. #define TX_CP1251      76        /* Cyrillic Windows */
  118. #define TX_CP1253      77        /* Greece Windows */
  119. #define TX_CP1254      78        /* Turkey Windows */
  120. #define TX_CP1257      79        /* Latin-4 Windows */
  121.  
  122. #define TX_CP856       80        /* Bulgaria CP856 (DATECS Ltd) */
  123. #define TX_CP855       81
  124. #define TX_CP819       82               /* Same as ISO 8859-1 */
  125. #define TX_CP912       83               /* Same as ISO 8859-2 */
  126. #define TX_CP913       84               /* Same as ISO 8859-3 */
  127. #define TX_CP914       85               /* Same as ISO 8859-4 */
  128. #define TX_CP915       86               /* Same as ISO 8859-5 */
  129. #define TX_CP1089      87               /* Same as ISO 8859-6 */
  130. #define TX_CP813       88               /* Same as ISO 8859-7 */
  131. #define TX_CP916       89               /* Same as ISO 8859-8 */
  132. #define TX_CP920       90               /* Same as ISO 8859-9 */
  133. #define TX_CP1051      91               /* Same as HP Roman 8 */
  134. #define TX_CP858       92               /* Multinational (W. Europe) w/Euro */
  135. #define TX_8859_15     93               /* Latin-9 */
  136. #define TX_CP923       94               /* Same as ISO 8859-15 */
  137.  
  138. #define TX_ELOT928     94               /* Same as ISO 8859-7 */
  139. #define TX_CP10000     95               /* Same as original Apple Quickdraw */
  140. #define TX_CP37        96               /* EBCDIC */
  141. #define TX_CP1255      97        /* Israel Windows */
  142. #define TX_CP1256      98        /* Arabic Windows */
  143. #define TX_CP1258      99        /* Viet Nam Windows */
  144. #define TX_MAZOVIA    100
  145. #define TX_TRANSP     101               /* Transparent - no translation */
  146. #define MAXTXSETS     102        /* Number of terminal character sets */
  147.  
  148. /* The following are not implemented yet */
  149. /* UTF-8 is supported as a special mode in Kermit 95 (see utf8 flag) */
  150.  
  151. #define TX_UTF7       128
  152. #define TX_UTF8       129
  153.  
  154. #define TX_HEXBYTES   242        /* Hex bytes */
  155. #define TX_DEBUG      243        /* Debugging but not hex bytes */
  156.  
  157. /* These are actually used */
  158.  
  159. #define TX_UNDEF      255               /* Unknown character-set */
  160.  
  161. /* Flag bit values */
  162.  
  163. #define X2U_STD   1            /* Has standard ISO 4873 layout */
  164. #define X2U_ISO   2            /* ISO standard character set */
  165. #define X2U_JIS   4            /* Japan Industrial Standard */
  166. #define X2U_CP    8            /* PC Code Page */
  167. #define X2U_DEC  16            /* DEC Private character set */
  168. #define X2U_CXG  32            /* Control codes used for graphics */
  169.  
  170. struct x_to_unicode {
  171.     int size;                /* 94, 96, 128, or other */
  172.     int offset;                /* 0, 32, 33, 128, 160, ... */
  173.     int flags;
  174.     int family;                /* Language family, writing system */
  175.     char * keywd;            /* Keyword name */
  176.     char * name;            /* Descriptive name */
  177.     int code;                /* ISO reg number if Standard */
  178.                     /* CP number if Code-page, etc. */
  179.     char * final;            /* Esc seq final char(s) (ISO, DEC) */
  180.     unsigned short map[256];        /* Mapping table */
  181. };
  182.  
  183. extern struct keytab txrtab[];
  184. extern int ntxrtab;
  185.  
  186. #ifndef NULL
  187. #define NULL (char *)0
  188. #endif /* NULL */
  189.  
  190. #ifndef USHORT
  191. #define USHORT unsigned short
  192. #endif /* USHORT */
  193.  
  194. #ifndef ULONG
  195. #define ULONG unsigned long
  196. #endif /* ULONG */
  197.  
  198. #ifndef CHAR
  199. #define CHAR unsigned char
  200. #endif /* CHAR */
  201.  
  202. #ifndef CONST
  203. #ifdef CK_ANSIC
  204. #define CONST const
  205. #else
  206. #define CONST
  207. #endif /* CK_ANSIC */
  208. #endif /* CONST */
  209.  
  210. #ifdef CK_ANSIC
  211. extern USHORT (*xl_u[MAXTXSETS+1])(CHAR); /* Blah-to-Unicode functions */
  212. extern int (*xl_tx[MAXTXSETS+1])(USHORT); /* Unicode-to-Blah functions */
  213. #else
  214. extern USHORT (*xl_u[MAXTXSETS+1])();
  215. extern int (*xl_tx[MAXTXSETS+1])();
  216. #endif /* CK_ANSIC */
  217. extern struct x_to_unicode * txrinfo[MAXTXSETS+1];
  218.  
  219. #ifdef OS2
  220. #ifdef NT
  221. _inline
  222. #else
  223. _Inline
  224. #endif /* NT */
  225. #endif /* OS2 */
  226. int
  227. isunicode(
  228. #ifdef CK_ANSIC
  229.       void
  230. #endif /* CK_ANSIC */
  231.       ) {
  232.     extern int tt_unicode;
  233. #ifdef NT
  234. #ifdef KUI
  235.     return(tt_unicode);
  236. #else /* KUI */
  237.     if (tt_unicode && !isWin95())
  238.       return(1);
  239.     else
  240.       return(0);
  241. #endif /* KUI */
  242. #else /* NT */
  243.     return(0);
  244. #endif /* NT */
  245. }
  246.  
  247. _PROTOTYP(int utf8_to_ucs2, (CHAR, USHORT **));
  248. _PROTOTYP(int ucs2_to_utf8, (USHORT, CHAR **));
  249. _PROTOTYP(int tx_cpsub, (USHORT));
  250. #endif /* CKOUNI_H */
  251.