ckcuni.c
资源名称:cku197.tar.Z [点击查看]
上传用户:dufan58
上传日期:2007-01-05
资源大小:3407k
文件大小:695k
源码类别:
通讯/手机编程
开发平台:
Windows_Unix
- case 0x00d6: return((CHAR)(153 & 0xff));
- case 0x00dc: return((CHAR)(154 & 0xff));
- case 0x00f8: return((CHAR)(155 & 0xff));
- case 0x00a3: return((CHAR)(156 & 0xff));
- case 0x00d8: return((CHAR)(157 & 0xff));
- case 0x015e: return((CHAR)(158 & 0xff));
- case 0x015f: return((CHAR)(159 & 0xff));
- case 0x00e1: return((CHAR)(160 & 0xff));
- case 0x00ed: return((CHAR)(161 & 0xff));
- case 0x00f3: return((CHAR)(162 & 0xff));
- case 0x00fa: return((CHAR)(163 & 0xff));
- case 0x00f1: return((CHAR)(164 & 0xff));
- case 0x00d1: return((CHAR)(165 & 0xff));
- case 0x011e: return((CHAR)(166 & 0xff));
- case 0x011f: return((CHAR)(167 & 0xff));
- case 0x00bf: return((CHAR)(168 & 0xff));
- case 0x00ae: return((CHAR)(169 & 0xff));
- case 0x00ac: return((CHAR)(170 & 0xff));
- case 0x00bd: return((CHAR)(171 & 0xff));
- case 0x00bc: return((CHAR)(172 & 0xff));
- case 0x00a1: return((CHAR)(173 & 0xff));
- case 0x00ab: return((CHAR)(174 & 0xff));
- case 0x00bb: return((CHAR)(175 & 0xff));
- case 0x20ac: return((CHAR)(213 & 0xff)); /* Euro */
- case 0x2591: return((CHAR)(176 & 0xff));
- case 0x2592: return((CHAR)(177 & 0xff));
- case 0x2593: return((CHAR)(178 & 0xff));
- case 0x2502: return((CHAR)(179 & 0xff));
- case 0x2524: return((CHAR)(180 & 0xff));
- case 0x00c1: return((CHAR)(181 & 0xff));
- case 0x00c2: return((CHAR)(182 & 0xff));
- case 0x00c0: return((CHAR)(183 & 0xff));
- case 0x00a9: return((CHAR)(184 & 0xff));
- case 0x2563: return((CHAR)(185 & 0xff));
- case 0x2551: return((CHAR)(186 & 0xff));
- case 0x2557: return((CHAR)(187 & 0xff));
- case 0x255d: return((CHAR)(188 & 0xff));
- case 0x00a2: return((CHAR)(189 & 0xff));
- case 0x00a5: return((CHAR)(190 & 0xff));
- case 0x2510: return((CHAR)(191 & 0xff));
- case 0x2514: return((CHAR)(192 & 0xff));
- case 0x2534: return((CHAR)(193 & 0xff));
- case 0x252c: return((CHAR)(194 & 0xff));
- case 0x251c: return((CHAR)(195 & 0xff));
- case 0x2500: return((CHAR)(196 & 0xff));
- case 0x253c: return((CHAR)(197 & 0xff));
- case 0x00e3: return((CHAR)(198 & 0xff));
- case 0x00c3: return((CHAR)(199 & 0xff));
- case 0x255a: return((CHAR)(200 & 0xff));
- case 0x2554: return((CHAR)(201 & 0xff));
- case 0x2569: return((CHAR)(202 & 0xff));
- case 0x2566: return((CHAR)(203 & 0xff));
- case 0x2560: return((CHAR)(204 & 0xff));
- case 0x2550: return((CHAR)(205 & 0xff));
- case 0x256c: return((CHAR)(206 & 0xff));
- case 0x00a4: return((CHAR)(207 & 0xff));
- case 0x00ba: return((CHAR)(208 & 0xff));
- case 0x00aa: return((CHAR)(209 & 0xff));
- case 0x00ca: return((CHAR)(210 & 0xff));
- case 0x00cb: return((CHAR)(211 & 0xff));
- case 0x00c8: return((CHAR)(212 & 0xff));
- case 0x00cd: return((CHAR)(214 & 0xff));
- case 0x00ce: return((CHAR)(215 & 0xff));
- case 0x00cf: return((CHAR)(216 & 0xff));
- case 0x2518: return((CHAR)(217 & 0xff));
- case 0x250c: return((CHAR)(218 & 0xff));
- case 0x2588: return((CHAR)(219 & 0xff));
- case 0x2584: return((CHAR)(220 & 0xff));
- case 0x00a6: return((CHAR)(221 & 0xff));
- case 0x00cc: return((CHAR)(222 & 0xff));
- case 0x2580: return((CHAR)(223 & 0xff));
- case 0x00d3: return((CHAR)(224 & 0xff));
- case 0x00df: return((CHAR)(225 & 0xff));
- case 0x00d4: return((CHAR)(226 & 0xff));
- case 0x00d2: return((CHAR)(227 & 0xff));
- case 0x00f5: return((CHAR)(228 & 0xff));
- case 0x00d5: return((CHAR)(229 & 0xff));
- case 0x00b5: return((CHAR)(230 & 0xff));
- case 0x00d7: return((CHAR)(232 & 0xff));
- case 0x00da: return((CHAR)(233 & 0xff));
- case 0x00db: return((CHAR)(234 & 0xff));
- case 0x00d9: return((CHAR)(235 & 0xff));
- case 0x00ec: return((CHAR)(236 & 0xff));
- case 0x00ff: return((CHAR)(237 & 0xff));
- case 0x00af: return((CHAR)(238 & 0xff));
- case 0x00b4: return((CHAR)(239 & 0xff));
- case 0x00ad: return((CHAR)(240 & 0xff));
- case 0x00b1: return((CHAR)(241 & 0xff));
- case 0x00be: return((CHAR)(243 & 0xff));
- case 0x00b6: return((CHAR)(244 & 0xff));
- case 0x00a7: return((CHAR)(245 & 0xff));
- case 0x00f7: return((CHAR)(246 & 0xff));
- case 0x00b8: return((CHAR)(247 & 0xff));
- case 0x00b0: return((CHAR)(248 & 0xff));
- case 0x00a8: return((CHAR)(249 & 0xff));
- case 0x00b7: return((CHAR)(250 & 0xff));
- case 0x00b9: return((CHAR)(251 & 0xff));
- case 0x00b3: return((CHAR)(252 & 0xff));
- case 0x00b2: return((CHAR)(253 & 0xff));
- case 0x25a0: return((CHAR)(254 & 0xff));
- case 0x00a0: return((CHAR)(255 & 0xff));
- default: return(tx_cpsub(c)); /* For box characters etc */
- }
- }
- int /* PC Code Page 862 */
- #ifdef CK_ANSIC
- tx_cp862(USHORT c)
- #else
- tx_cp862(c) USHORT c;
- #endif /* CK_ANSIC */
- {
- if (c < 0x80) /* Has C1 graphics */
- return((CHAR)(c & 0xff));
- switch (c) {
- case 0x05d0: return((CHAR)(128 & 0xff));
- case 0x05d1: return((CHAR)(129 & 0xff));
- case 0x05d2: return((CHAR)(130 & 0xff));
- case 0x05d3: return((CHAR)(131 & 0xff));
- case 0x05d4: return((CHAR)(132 & 0xff));
- case 0x05d5: return((CHAR)(133 & 0xff));
- case 0x05d6: return((CHAR)(134 & 0xff));
- case 0x05d7: return((CHAR)(135 & 0xff));
- case 0x05d8: return((CHAR)(136 & 0xff));
- case 0x05d9: return((CHAR)(137 & 0xff));
- case 0x05da: return((CHAR)(138 & 0xff));
- case 0x05db: return((CHAR)(139 & 0xff));
- case 0x05dc: return((CHAR)(140 & 0xff));
- case 0x05dd: return((CHAR)(141 & 0xff));
- case 0x05de: return((CHAR)(142 & 0xff));
- case 0x05df: return((CHAR)(143 & 0xff));
- case 0x05e0: return((CHAR)(144 & 0xff));
- case 0x05e1: return((CHAR)(145 & 0xff));
- case 0x05e2: return((CHAR)(146 & 0xff));
- case 0x05e3: return((CHAR)(147 & 0xff));
- case 0x05e4: return((CHAR)(148 & 0xff));
- case 0x05e5: return((CHAR)(149 & 0xff));
- case 0x05e6: return((CHAR)(150 & 0xff));
- case 0x05e7: return((CHAR)(151 & 0xff));
- case 0x05e8: return((CHAR)(152 & 0xff));
- case 0x05e9: return((CHAR)(153 & 0xff));
- case 0x05ea: return((CHAR)(154 & 0xff));
- case 0x00a2: return((CHAR)(155 & 0xff));
- case 0x00a3: return((CHAR)(156 & 0xff));
- case 0x00a5: return((CHAR)(157 & 0xff));
- case 0x20a7: return((CHAR)(158 & 0xff));
- case 0x0192: return((CHAR)(159 & 0xff));
- case 0x00e1: return((CHAR)(160 & 0xff));
- case 0x00ed: return((CHAR)(161 & 0xff));
- case 0x00f3: return((CHAR)(162 & 0xff));
- case 0x00fa: return((CHAR)(163 & 0xff));
- case 0x00f1: return((CHAR)(164 & 0xff));
- case 0x00d1: return((CHAR)(165 & 0xff));
- case 0x00aa: return((CHAR)(166 & 0xff));
- case 0x00ba: return((CHAR)(167 & 0xff));
- case 0x00bf: return((CHAR)(168 & 0xff));
- case 0x2310: return((CHAR)(169 & 0xff));
- case 0x00ac: return((CHAR)(170 & 0xff));
- case 0x00bd: return((CHAR)(171 & 0xff));
- case 0x00bc: return((CHAR)(172 & 0xff));
- case 0x00a1: return((CHAR)(173 & 0xff));
- case 0x00ab: return((CHAR)(174 & 0xff));
- case 0x00bb: return((CHAR)(175 & 0xff));
- case 0x2591: return((CHAR)(176 & 0xff));
- case 0x2592: return((CHAR)(177 & 0xff));
- case 0x2593: return((CHAR)(178 & 0xff));
- case 0x2502: return((CHAR)(179 & 0xff));
- case 0x2524: return((CHAR)(180 & 0xff));
- case 0x2561: return((CHAR)(181 & 0xff));
- case 0x2562: return((CHAR)(182 & 0xff));
- case 0x2556: return((CHAR)(183 & 0xff));
- case 0x2555: return((CHAR)(184 & 0xff));
- case 0x2563: return((CHAR)(185 & 0xff));
- case 0x2551: return((CHAR)(186 & 0xff));
- case 0x2557: return((CHAR)(187 & 0xff));
- case 0x255d: return((CHAR)(188 & 0xff));
- case 0x255c: return((CHAR)(189 & 0xff));
- case 0x255b: return((CHAR)(190 & 0xff));
- case 0x2510: return((CHAR)(191 & 0xff));
- case 0x2514: return((CHAR)(192 & 0xff));
- case 0x2534: return((CHAR)(193 & 0xff));
- case 0x252c: return((CHAR)(194 & 0xff));
- case 0x251c: return((CHAR)(195 & 0xff));
- case 0x2500: return((CHAR)(196 & 0xff));
- case 0x253c: return((CHAR)(197 & 0xff));
- case 0x255e: return((CHAR)(198 & 0xff));
- case 0x255f: return((CHAR)(199 & 0xff));
- case 0x255a: return((CHAR)(200 & 0xff));
- case 0x2554: return((CHAR)(201 & 0xff));
- case 0x2569: return((CHAR)(202 & 0xff));
- case 0x2566: return((CHAR)(203 & 0xff));
- case 0x2560: return((CHAR)(204 & 0xff));
- case 0x2550: return((CHAR)(205 & 0xff));
- case 0x256c: return((CHAR)(206 & 0xff));
- case 0x2567: return((CHAR)(207 & 0xff));
- case 0x2568: return((CHAR)(208 & 0xff));
- case 0x2564: return((CHAR)(209 & 0xff));
- case 0x2565: return((CHAR)(210 & 0xff));
- case 0x2559: return((CHAR)(211 & 0xff));
- case 0x2558: return((CHAR)(212 & 0xff));
- case 0x2552: return((CHAR)(213 & 0xff));
- case 0x2553: return((CHAR)(214 & 0xff));
- case 0x256b: return((CHAR)(215 & 0xff));
- case 0x256a: return((CHAR)(216 & 0xff));
- case 0x2518: return((CHAR)(217 & 0xff));
- case 0x250c: return((CHAR)(218 & 0xff));
- case 0x2588: return((CHAR)(219 & 0xff));
- case 0x2584: return((CHAR)(220 & 0xff));
- case 0x258c: return((CHAR)(221 & 0xff));
- case 0x2590: return((CHAR)(222 & 0xff));
- case 0x2580: return((CHAR)(223 & 0xff));
- case 0x03b1: return((CHAR)(224 & 0xff));
- case 0x00df: return((CHAR)(225 & 0xff));
- case 0x0393: return((CHAR)(226 & 0xff));
- case 0x03c0: return((CHAR)(227 & 0xff));
- case 0x03a3: return((CHAR)(228 & 0xff));
- case 0x03c3: return((CHAR)(229 & 0xff));
- case 0x00b5: return((CHAR)(230 & 0xff));
- case 0x03c4: return((CHAR)(231 & 0xff));
- case 0x03a6: return((CHAR)(232 & 0xff));
- case 0x0398: return((CHAR)(233 & 0xff));
- case 0x03a9: return((CHAR)(234 & 0xff));
- case 0x03b4: return((CHAR)(235 & 0xff));
- case 0x221e: return((CHAR)(236 & 0xff));
- case 0x03c6: return((CHAR)(237 & 0xff));
- case 0x03b5: return((CHAR)(238 & 0xff));
- case 0x2229: return((CHAR)(239 & 0xff));
- case 0x2261: return((CHAR)(240 & 0xff));
- case 0x00b1: return((CHAR)(241 & 0xff));
- case 0x2265: return((CHAR)(242 & 0xff));
- case 0x2264: return((CHAR)(243 & 0xff));
- case 0x2320: return((CHAR)(244 & 0xff));
- case 0x2321: return((CHAR)(245 & 0xff));
- case 0x00f7: return((CHAR)(246 & 0xff));
- case 0x2248: return((CHAR)(247 & 0xff));
- case 0x00b0: return((CHAR)(248 & 0xff));
- case 0x2219: return((CHAR)(249 & 0xff));
- case 0x00b7: return((CHAR)(250 & 0xff));
- case 0x221a: return((CHAR)(251 & 0xff));
- case 0x207f: return((CHAR)(252 & 0xff));
- case 0x00b2: return((CHAR)(253 & 0xff));
- case 0x25a0: return((CHAR)(254 & 0xff));
- case 0x00a0: return((CHAR)(255 & 0xff));
- default: return(tx_cpsub(c)); /* For box characters etc */
- }
- }
- int /* PC Code Page 864 */
- #ifdef CK_ANSIC
- tx_cp864(USHORT c)
- #else
- tx_cp864(c) USHORT c;
- #endif /* CK_ANSIC */
- {
- if (c < 0x80) /* Has C1 graphics */
- return((CHAR)(c & 0xff));
- switch (c) {
- case 0x00b0: return((CHAR)0x80 & 0xff);
- case 0x00b7: return((CHAR)0x81 & 0xff);
- case 0x2219: return((CHAR)0x82 & 0xff);
- case 0x221a: return((CHAR)0x83 & 0xff);
- case 0x2592: return((CHAR)0x84 & 0xff);
- case 0x2500: return((CHAR)0x85 & 0xff);
- case 0x2502: return((CHAR)0x86 & 0xff);
- case 0x253c: return((CHAR)0x87 & 0xff);
- case 0x2524: return((CHAR)0x88 & 0xff);
- case 0x252c: return((CHAR)0x89 & 0xff);
- case 0x251c: return((CHAR)0x8a & 0xff);
- case 0x2534: return((CHAR)0x8b & 0xff);
- case 0x2510: return((CHAR)0x8c & 0xff);
- case 0x250c: return((CHAR)0x8d & 0xff);
- case 0x2514: return((CHAR)0x8e & 0xff);
- case 0x2518: return((CHAR)0x8f & 0xff);
- case 0x03b2: return((CHAR)0x90 & 0xff);
- case 0x221e: return((CHAR)0x91 & 0xff);
- case 0x03c6: return((CHAR)0x92 & 0xff);
- case 0x00b1: return((CHAR)0x93 & 0xff);
- case 0x00bd: return((CHAR)0x94 & 0xff);
- case 0x00bc: return((CHAR)0x95 & 0xff);
- case 0x2248: return((CHAR)0x96 & 0xff);
- case 0x00ab: return((CHAR)0x97 & 0xff);
- case 0x00bb: return((CHAR)0x98 & 0xff);
- case 0xfef7: return((CHAR)0x99 & 0xff);
- case 0xfef8: return((CHAR)0x9a & 0xff);
- case 0xfefb: return((CHAR)0x9d & 0xff);
- case 0xfefc: return((CHAR)0x9e & 0xff);
- case 0x00a0: return((CHAR)0xa0 & 0xff);
- case 0x00ad: return((CHAR)0xa1 & 0xff);
- case 0xfe82: return((CHAR)0xa2 & 0xff);
- case 0x00a3: return((CHAR)0xa3 & 0xff);
- case 0x00a4: return((CHAR)0xa4 & 0xff);
- case 0xfe84: return((CHAR)0xa5 & 0xff);
- case 0xfe8e: return((CHAR)0xa8 & 0xff);
- case 0xfe8f: return((CHAR)0xa9 & 0xff);
- case 0xfe95: return((CHAR)0xaa & 0xff);
- case 0xfe99: return((CHAR)0xab & 0xff);
- case 0x060c: return((CHAR)0xac & 0xff);
- case 0xfe9d: return((CHAR)0xad & 0xff);
- case 0xfea1: return((CHAR)0xae & 0xff);
- case 0xfea5: return((CHAR)0xaf & 0xff);
- case 0x0660: return((CHAR)0xb0 & 0xff);
- case 0x0661: return((CHAR)0xb1 & 0xff);
- case 0x0662: return((CHAR)0xb2 & 0xff);
- case 0x0663: return((CHAR)0xb3 & 0xff);
- case 0x0664: return((CHAR)0xb4 & 0xff);
- case 0x0665: return((CHAR)0xb5 & 0xff);
- case 0x0666: return((CHAR)0xb6 & 0xff);
- case 0x0667: return((CHAR)0xb7 & 0xff);
- case 0x0668: return((CHAR)0xb8 & 0xff);
- case 0x0669: return((CHAR)0xb9 & 0xff);
- case 0xfed1: return((CHAR)0xba & 0xff);
- case 0x061b: return((CHAR)0xbb & 0xff);
- case 0xfeb1: return((CHAR)0xbc & 0xff);
- case 0xfeb5: return((CHAR)0xbd & 0xff);
- case 0xfeb9: return((CHAR)0xbe & 0xff);
- case 0x061f: return((CHAR)0xbf & 0xff);
- case 0x00a2: return((CHAR)0xc0 & 0xff);
- case 0xfe80: return((CHAR)0xc1 & 0xff);
- case 0xfe81: return((CHAR)0xc2 & 0xff);
- case 0xfe83: return((CHAR)0xc3 & 0xff);
- case 0xfe85: return((CHAR)0xc4 & 0xff);
- case 0xfeca: return((CHAR)0xc5 & 0xff);
- case 0xfe8b: return((CHAR)0xc6 & 0xff);
- case 0xfe8d: return((CHAR)0xc7 & 0xff);
- case 0xfe91: return((CHAR)0xc8 & 0xff);
- case 0xfe93: return((CHAR)0xc9 & 0xff);
- case 0xfe97: return((CHAR)0xca & 0xff);
- case 0xfe9b: return((CHAR)0xcb & 0xff);
- case 0xfe9f: return((CHAR)0xcc & 0xff);
- case 0xfea3: return((CHAR)0xcd & 0xff);
- case 0xfea7: return((CHAR)0xce & 0xff);
- case 0xfea9: return((CHAR)0xcf & 0xff);
- case 0xfeab: return((CHAR)0xd0 & 0xff);
- case 0xfead: return((CHAR)0xd1 & 0xff);
- case 0xfeaf: return((CHAR)0xd2 & 0xff);
- case 0xfeb3: return((CHAR)0xd3 & 0xff);
- case 0xfeb7: return((CHAR)0xd4 & 0xff);
- case 0xfebb: return((CHAR)0xd5 & 0xff);
- case 0xfebf: return((CHAR)0xd6 & 0xff);
- case 0xfec1: return((CHAR)0xd7 & 0xff);
- case 0xfec5: return((CHAR)0xd8 & 0xff);
- case 0xfecb: return((CHAR)0xd9 & 0xff);
- case 0xfecf: return((CHAR)0xda & 0xff);
- case 0x00a6: return((CHAR)0xdb & 0xff);
- case 0x00ac: return((CHAR)0xdc & 0xff);
- case 0x00f7: return((CHAR)0xdd & 0xff);
- case 0x00d7: return((CHAR)0xde & 0xff);
- case 0xfec9: return((CHAR)0xdf & 0xff);
- case 0x0640: return((CHAR)0xe0 & 0xff);
- case 0xfed3: return((CHAR)0xe1 & 0xff);
- case 0xfed7: return((CHAR)0xe2 & 0xff);
- case 0xfedb: return((CHAR)0xe3 & 0xff);
- case 0xfedf: return((CHAR)0xe4 & 0xff);
- case 0xfee3: return((CHAR)0xe5 & 0xff);
- case 0xfee7: return((CHAR)0xe6 & 0xff);
- case 0xfeeb: return((CHAR)0xe7 & 0xff);
- case 0xfeed: return((CHAR)0xe8 & 0xff);
- case 0xfeef: return((CHAR)0xe9 & 0xff);
- case 0xfef3: return((CHAR)0xea & 0xff);
- case 0xfebd: return((CHAR)0xeb & 0xff);
- case 0xfecc: return((CHAR)0xec & 0xff);
- case 0xfece: return((CHAR)0xed & 0xff);
- case 0xfecd: return((CHAR)0xee & 0xff);
- case 0xfee1: return((CHAR)0xef & 0xff);
- case 0xfe7d: return((CHAR)0xf0 & 0xff);
- case 0x0651: return((CHAR)0xf1 & 0xff);
- case 0xfee5: return((CHAR)0xf2 & 0xff);
- case 0xfee9: return((CHAR)0xf3 & 0xff);
- case 0xfeec: return((CHAR)0xf4 & 0xff);
- case 0xfef0: return((CHAR)0xf5 & 0xff);
- case 0xfef2: return((CHAR)0xf6 & 0xff);
- case 0xfed0: return((CHAR)0xf7 & 0xff);
- case 0xfed5: return((CHAR)0xf8 & 0xff);
- case 0xfef5: return((CHAR)0xf9 & 0xff);
- case 0xfef6: return((CHAR)0xfa & 0xff);
- case 0xfedd: return((CHAR)0xfb & 0xff);
- case 0xfed9: return((CHAR)0xfc & 0xff);
- case 0xfef1: return((CHAR)0xfd & 0xff);
- case 0x25a0: return((CHAR)0xfe & 0xff);
- default: return(tx_cpsub(c)); /* For box characters etc */
- }
- }
- int /* PC Code Page 866 */
- #ifdef CK_ANSIC
- tx_cp866(USHORT c)
- #else
- tx_cp866(c) USHORT c;
- #endif /* CK_ANSIC */
- {
- if (c < 0x80) /* Has C1 graphics */
- return((CHAR)(c & 0xff));
- switch (c) {
- case 0x00a0: return((CHAR)(255 & 0xff));
- case 0x00a4: return((CHAR)(253 & 0xff));
- case 0x00b0: return((CHAR)(248 & 0xff));
- case 0x00b7: return((CHAR)(250 & 0xff));
- case 0x0401: return((CHAR)(240 & 0xff));
- case 0x0404: return((CHAR)(242 & 0xff));
- case 0x0407: return((CHAR)(244 & 0xff));
- case 0x040e: return((CHAR)(246 & 0xff));
- case 0x0410: return((CHAR)(128 & 0xff));
- case 0x0411: return((CHAR)(129 & 0xff));
- case 0x0412: return((CHAR)(130 & 0xff));
- case 0x0413: return((CHAR)(131 & 0xff));
- case 0x0414: return((CHAR)(132 & 0xff));
- case 0x0415: return((CHAR)(133 & 0xff));
- case 0x0416: return((CHAR)(134 & 0xff));
- case 0x0417: return((CHAR)(135 & 0xff));
- case 0x0418: return((CHAR)(136 & 0xff));
- case 0x0419: return((CHAR)(137 & 0xff));
- case 0x041a: return((CHAR)(138 & 0xff));
- case 0x041b: return((CHAR)(139 & 0xff));
- case 0x041c: return((CHAR)(140 & 0xff));
- case 0x041d: return((CHAR)(141 & 0xff));
- case 0x041e: return((CHAR)(142 & 0xff));
- case 0x041f: return((CHAR)(143 & 0xff));
- case 0x0420: return((CHAR)(144 & 0xff));
- case 0x0421: return((CHAR)(145 & 0xff));
- case 0x0422: return((CHAR)(146 & 0xff));
- case 0x0423: return((CHAR)(147 & 0xff));
- case 0x0424: return((CHAR)(148 & 0xff));
- case 0x0425: return((CHAR)(149 & 0xff));
- case 0x0426: return((CHAR)(150 & 0xff));
- case 0x0427: return((CHAR)(151 & 0xff));
- case 0x0428: return((CHAR)(152 & 0xff));
- case 0x0429: return((CHAR)(153 & 0xff));
- case 0x042a: return((CHAR)(154 & 0xff));
- case 0x042b: return((CHAR)(155 & 0xff));
- case 0x042c: return((CHAR)(156 & 0xff));
- case 0x042d: return((CHAR)(157 & 0xff));
- case 0x042e: return((CHAR)(158 & 0xff));
- case 0x042f: return((CHAR)(159 & 0xff));
- case 0x0430: return((CHAR)(160 & 0xff));
- case 0x0431: return((CHAR)(161 & 0xff));
- case 0x0432: return((CHAR)(162 & 0xff));
- case 0x0433: return((CHAR)(163 & 0xff));
- case 0x0434: return((CHAR)(164 & 0xff));
- case 0x0435: return((CHAR)(165 & 0xff));
- case 0x0436: return((CHAR)(166 & 0xff));
- case 0x0437: return((CHAR)(167 & 0xff));
- case 0x0438: return((CHAR)(168 & 0xff));
- case 0x0439: return((CHAR)(169 & 0xff));
- case 0x043a: return((CHAR)(170 & 0xff));
- case 0x043b: return((CHAR)(171 & 0xff));
- case 0x043c: return((CHAR)(172 & 0xff));
- case 0x043d: return((CHAR)(173 & 0xff));
- case 0x043e: return((CHAR)(174 & 0xff));
- case 0x043f: return((CHAR)(175 & 0xff));
- case 0x0440: return((CHAR)(224 & 0xff));
- case 0x0441: return((CHAR)(225 & 0xff));
- case 0x0442: return((CHAR)(226 & 0xff));
- case 0x0443: return((CHAR)(227 & 0xff));
- case 0x0444: return((CHAR)(228 & 0xff));
- case 0x0445: return((CHAR)(229 & 0xff));
- case 0x0446: return((CHAR)(230 & 0xff));
- case 0x0447: return((CHAR)(231 & 0xff));
- case 0x0448: return((CHAR)(232 & 0xff));
- case 0x0449: return((CHAR)(233 & 0xff));
- case 0x044a: return((CHAR)(234 & 0xff));
- case 0x044b: return((CHAR)(235 & 0xff));
- case 0x044c: return((CHAR)(236 & 0xff));
- case 0x044d: return((CHAR)(237 & 0xff));
- case 0x044e: return((CHAR)(238 & 0xff));
- case 0x044f: return((CHAR)(239 & 0xff));
- case 0x0451: return((CHAR)(241 & 0xff));
- case 0x0454: return((CHAR)(243 & 0xff));
- case 0x0457: return((CHAR)(245 & 0xff));
- case 0x045e: return((CHAR)(247 & 0xff));
- case 0x2116: return((CHAR)(252 & 0xff));
- case 0x2219: return((CHAR)(249 & 0xff));
- case 0x221a: return((CHAR)(251 & 0xff));
- case 0x2500: return((CHAR)(196 & 0xff));
- case 0x2502: return((CHAR)(179 & 0xff));
- case 0x250c: return((CHAR)(218 & 0xff));
- case 0x2510: return((CHAR)(191 & 0xff));
- case 0x2514: return((CHAR)(192 & 0xff));
- case 0x2518: return((CHAR)(217 & 0xff));
- case 0x251c: return((CHAR)(195 & 0xff));
- case 0x2524: return((CHAR)(180 & 0xff));
- case 0x252c: return((CHAR)(194 & 0xff));
- case 0x2534: return((CHAR)(193 & 0xff));
- case 0x253c: return((CHAR)(197 & 0xff));
- case 0x2550: return((CHAR)(205 & 0xff));
- case 0x2551: return((CHAR)(186 & 0xff));
- case 0x2552: return((CHAR)(213 & 0xff));
- case 0x2553: return((CHAR)(214 & 0xff));
- case 0x2554: return((CHAR)(201 & 0xff));
- case 0x2555: return((CHAR)(184 & 0xff));
- case 0x2556: return((CHAR)(183 & 0xff));
- case 0x2557: return((CHAR)(187 & 0xff));
- case 0x2558: return((CHAR)(212 & 0xff));
- case 0x2559: return((CHAR)(211 & 0xff));
- case 0x255a: return((CHAR)(200 & 0xff));
- case 0x255b: return((CHAR)(190 & 0xff));
- case 0x255c: return((CHAR)(189 & 0xff));
- case 0x255d: return((CHAR)(188 & 0xff));
- case 0x255e: return((CHAR)(198 & 0xff));
- case 0x255f: return((CHAR)(199 & 0xff));
- case 0x2560: return((CHAR)(204 & 0xff));
- case 0x2561: return((CHAR)(181 & 0xff));
- case 0x2562: return((CHAR)(182 & 0xff));
- case 0x2563: return((CHAR)(185 & 0xff));
- case 0x2564: return((CHAR)(209 & 0xff));
- case 0x2565: return((CHAR)(210 & 0xff));
- case 0x2566: return((CHAR)(203 & 0xff));
- case 0x2567: return((CHAR)(207 & 0xff));
- case 0x2568: return((CHAR)(208 & 0xff));
- case 0x2569: return((CHAR)(202 & 0xff));
- case 0x256a: return((CHAR)(216 & 0xff));
- case 0x256b: return((CHAR)(215 & 0xff));
- case 0x256c: return((CHAR)(206 & 0xff));
- case 0x2580: return((CHAR)(223 & 0xff));
- case 0x2584: return((CHAR)(220 & 0xff));
- case 0x2588: return((CHAR)(219 & 0xff));
- case 0x258c: return((CHAR)(221 & 0xff));
- case 0x2590: return((CHAR)(222 & 0xff));
- case 0x2591: return((CHAR)(176 & 0xff));
- case 0x2592: return((CHAR)(177 & 0xff));
- case 0x2593: return((CHAR)(178 & 0xff));
- case 0x25a0: return((CHAR)(254 & 0xff));
- default: return(tx_cpsub(c)); /* For box characters etc */
- }
- }
- int /* PC Code Page 869 */
- #ifdef CK_ANSIC
- tx_cp869(USHORT c)
- #else
- tx_cp869(c) USHORT c;
- #endif /* CK_ANSIC */
- {
- if (c < 0x80) /* Has C1 graphics */
- return((CHAR)(c & 0xff));
- switch (c) {
- case 0x00a0: return((CHAR)(255 & 0xff));
- case 0x00a3: return((CHAR)(156 & 0xff));
- case 0x00a6: return((CHAR)(138 & 0xff));
- case 0x00a7: return((CHAR)(245 & 0xff));
- case 0x00a8: return((CHAR)(249 & 0xff));
- case 0x00a9: return((CHAR)(151 & 0xff));
- case 0x00ab: return((CHAR)(174 & 0xff));
- case 0x00ac: return((CHAR)(137 & 0xff));
- case 0x00ad: return((CHAR)(240 & 0xff));
- case 0x00b0: return((CHAR)(248 & 0xff));
- case 0x00b1: return((CHAR)(241 & 0xff));
- case 0x00b2: return((CHAR)(153 & 0xff));
- case 0x00b3: return((CHAR)(154 & 0xff));
- case 0x00b7: return((CHAR)(136 & 0xff));
- case 0x00bb: return((CHAR)(175 & 0xff));
- case 0x00bd: return((CHAR)(171 & 0xff));
- case 0x0384: return((CHAR)(239 & 0xff));
- case 0x0385: return((CHAR)(247 & 0xff));
- case 0x0386: return((CHAR)(134 & 0xff));
- case 0x0388: return((CHAR)(141 & 0xff));
- case 0x0389: return((CHAR)(143 & 0xff));
- case 0x038a: return((CHAR)(144 & 0xff));
- case 0x038c: return((CHAR)(146 & 0xff));
- case 0x038e: return((CHAR)(149 & 0xff));
- case 0x038f: return((CHAR)(152 & 0xff));
- case 0x0390: return((CHAR)(161 & 0xff));
- case 0x0391: return((CHAR)(164 & 0xff));
- case 0x0392: return((CHAR)(165 & 0xff));
- case 0x0393: return((CHAR)(166 & 0xff));
- case 0x0394: return((CHAR)(167 & 0xff));
- case 0x0395: return((CHAR)(168 & 0xff));
- case 0x0396: return((CHAR)(169 & 0xff));
- case 0x0397: return((CHAR)(170 & 0xff));
- case 0x0398: return((CHAR)(172 & 0xff));
- case 0x0399: return((CHAR)(173 & 0xff));
- case 0x039a: return((CHAR)(181 & 0xff));
- case 0x039b: return((CHAR)(182 & 0xff));
- case 0x039c: return((CHAR)(183 & 0xff));
- case 0x039d: return((CHAR)(184 & 0xff));
- case 0x039e: return((CHAR)(189 & 0xff));
- case 0x039f: return((CHAR)(190 & 0xff));
- case 0x03a0: return((CHAR)(198 & 0xff));
- case 0x03a1: return((CHAR)(199 & 0xff));
- case 0x03a3: return((CHAR)(207 & 0xff));
- case 0x03a4: return((CHAR)(208 & 0xff));
- case 0x03a5: return((CHAR)(209 & 0xff));
- case 0x03a6: return((CHAR)(210 & 0xff));
- case 0x03a7: return((CHAR)(211 & 0xff));
- case 0x03a8: return((CHAR)(212 & 0xff));
- case 0x03a9: return((CHAR)(213 & 0xff));
- case 0x03aa: return((CHAR)(145 & 0xff));
- case 0x03ab: return((CHAR)(150 & 0xff));
- case 0x03ac: return((CHAR)(155 & 0xff));
- case 0x03ad: return((CHAR)(157 & 0xff));
- case 0x03ae: return((CHAR)(158 & 0xff));
- case 0x03af: return((CHAR)(159 & 0xff));
- case 0x03b0: return((CHAR)(252 & 0xff));
- case 0x03b1: return((CHAR)(214 & 0xff));
- case 0x03b2: return((CHAR)(215 & 0xff));
- case 0x03b3: return((CHAR)(216 & 0xff));
- case 0x03b4: return((CHAR)(221 & 0xff));
- case 0x03b5: return((CHAR)(222 & 0xff));
- case 0x03b6: return((CHAR)(224 & 0xff));
- case 0x03b7: return((CHAR)(225 & 0xff));
- case 0x03b8: return((CHAR)(226 & 0xff));
- case 0x03b9: return((CHAR)(227 & 0xff));
- case 0x03ba: return((CHAR)(228 & 0xff));
- case 0x03bb: return((CHAR)(229 & 0xff));
- case 0x03bc: return((CHAR)(230 & 0xff));
- case 0x03bd: return((CHAR)(231 & 0xff));
- case 0x03be: return((CHAR)(232 & 0xff));
- case 0x03bf: return((CHAR)(233 & 0xff));
- case 0x03c0: return((CHAR)(234 & 0xff));
- case 0x03c1: return((CHAR)(235 & 0xff));
- case 0x03c2: return((CHAR)(237 & 0xff));
- case 0x03c3: return((CHAR)(236 & 0xff));
- case 0x03c4: return((CHAR)(238 & 0xff));
- case 0x03c5: return((CHAR)(242 & 0xff));
- case 0x03c6: return((CHAR)(243 & 0xff));
- case 0x03c7: return((CHAR)(244 & 0xff));
- case 0x03c8: return((CHAR)(246 & 0xff));
- case 0x03c9: return((CHAR)(250 & 0xff));
- case 0x03ca: return((CHAR)(160 & 0xff));
- case 0x03cb: return((CHAR)(251 & 0xff));
- case 0x03cc: return((CHAR)(162 & 0xff));
- case 0x03cd: return((CHAR)(163 & 0xff));
- case 0x03ce: return((CHAR)(253 & 0xff));
- case 0x2015: return((CHAR)(142 & 0xff));
- case 0x2018: return((CHAR)(139 & 0xff));
- case 0x2019: return((CHAR)(140 & 0xff));
- case 0x2500: return((CHAR)(196 & 0xff));
- case 0x2502: return((CHAR)(179 & 0xff));
- case 0x250c: return((CHAR)(218 & 0xff));
- case 0x2510: return((CHAR)(191 & 0xff));
- case 0x2514: return((CHAR)(192 & 0xff));
- case 0x2518: return((CHAR)(217 & 0xff));
- case 0x251c: return((CHAR)(195 & 0xff));
- case 0x2524: return((CHAR)(180 & 0xff));
- case 0x252c: return((CHAR)(194 & 0xff));
- case 0x2534: return((CHAR)(193 & 0xff));
- case 0x253c: return((CHAR)(197 & 0xff));
- case 0x2550: return((CHAR)(205 & 0xff));
- case 0x2551: return((CHAR)(186 & 0xff));
- case 0x2554: return((CHAR)(201 & 0xff));
- case 0x2557: return((CHAR)(187 & 0xff));
- case 0x255a: return((CHAR)(200 & 0xff));
- case 0x255d: return((CHAR)(188 & 0xff));
- case 0x2560: return((CHAR)(204 & 0xff));
- case 0x2563: return((CHAR)(185 & 0xff));
- case 0x2566: return((CHAR)(203 & 0xff));
- case 0x2569: return((CHAR)(202 & 0xff));
- case 0x256c: return((CHAR)(206 & 0xff));
- case 0x2580: return((CHAR)(223 & 0xff));
- case 0x2584: return((CHAR)(220 & 0xff));
- case 0x2588: return((CHAR)(219 & 0xff));
- case 0x2591: return((CHAR)(176 & 0xff));
- case 0x2592: return((CHAR)(177 & 0xff));
- case 0x2593: return((CHAR)(178 & 0xff));
- case 0x25a0: return((CHAR)(254 & 0xff));
- default: return(tx_cpsub(c)); /* For box characters etc */
- }
- }
- int /* PC Code Page C0 graphics */
- #ifdef CK_ANSIC
- tx_smiley(USHORT c)
- #else
- tx_smiley(c) USHORT c;
- #endif /* CK_ANSIC */
- {
- if (c > 0x1f)
- return(-1);
- switch (c) {
- case 0x00a0: return((CHAR)0 & 0x7f);
- case 0x00a7: return((CHAR)21 & 0x7f);
- case 0x00b6: return((CHAR)20 & 0x7f);
- case 0x2022: return((CHAR)7 & 0x7f);
- case 0x203c: return((CHAR)19 & 0x7f);
- case 0x2190: return((CHAR)27 & 0x7f);
- case 0x2191: return((CHAR)24 & 0x7f);
- case 0x2192: return((CHAR)26 & 0x7f);
- case 0x2193: return((CHAR)25 & 0x7f);
- case 0x2194: return((CHAR)29 & 0x7f);
- case 0x2195: return((CHAR)18 & 0x7f);
- case 0x21a8: return((CHAR)23 & 0x7f);
- case 0x2319: return((CHAR)28 & 0x7f);
- case 0x25ac: return((CHAR)22 & 0x7f);
- case 0x25b2: return((CHAR)30 & 0x7f);
- case 0x25ba: return((CHAR)16 & 0x7f);
- case 0x25bc: return((CHAR)31 & 0x7f);
- case 0x25c4: return((CHAR)17 & 0x7f);
- case 0x25d8: return((CHAR)8 & 0x7f);
- case 0x25d9: return((CHAR)10 & 0x7f);
- case 0x25ef: return((CHAR)9 & 0x7f);
- case 0x263a: return((CHAR)1 & 0x7f);
- case 0x263b: return((CHAR)2 & 0x7f);
- case 0x263c: return((CHAR)15 & 0x7f);
- case 0x2640: return((CHAR)12 & 0x7f);
- case 0x2642: return((CHAR)11 & 0x7f);
- case 0x2660: return((CHAR)6 & 0x7f);
- case 0x2663: return((CHAR)5 & 0x7f);
- case 0x2665: return((CHAR)3 & 0x7f);
- case 0x2666: return((CHAR)4 & 0x7f);
- case 0x266a: return((CHAR)13 & 0x7f);
- case 0x266c: return((CHAR)14 & 0x7f);
- default: return(-1);
- }
- }
- USHORT /* Kermit font 0xE??? to Unicode substitutions */
- #ifdef CK_ANSIC
- tx_usub(USHORT c)
- #else
- tx_usub(c) USHORT c;
- #endif /* CK_ANSIC */
- {
- if (c < 0xE000 || c > 0xEFFF)
- return(c);
- switch (c) {
- case 0xE200: return(0x2524); /* Extensible Left Brace Middle */
- case 0xE201: return(0x2570); /* Extensible Left Parenthesis bot */
- case 0xE202: return(0x256d); /* Extensible left parenthesis top */
- case 0xE203: return(0x2514); /* Extensible left SB bot */
- case 0xE204: return(0x250c); /* Extensible left SB top */
- case 0xE205: return(0x251c); /* Extensible right brace middle */
- case 0xE206: return(0x256f); /* Extensible right parenthesis bot */
- case 0xE207: return(0x256e); /* Extensible right parenthesis top */
- case 0xE208: return(0x2518); /* Extensible right SB bot */
- case 0xE209: return(0x2510); /* Extensible right SB top */
- case 0xE20C: return(0x03a3); /* Summation symbol bot */
- case 0xE20D: return(0x03a3); /* Summation symbol top */
- case 0xE20E: return(0x2510); /* Right ceiling corner */
- case 0xE20F: return(0x2518); /* Right floor corner */
- case 0xE300: return(0x2502); /* V box line, extensible, left */
- case 0xE309: return(0x2502); /* V box line, extensible, right */
- case 0xE30A: return(0x258c); /* Diagonal fill, dark, UL */
- case 0xE30B: return(0x2590); /* Diagonal fill, dark, UR */
- case 0xE311: return(0x2500); /* H line - Scan 1 */
- case 0xE313: return(0x2500); /* H line - Scan 3 */
- case 0xE315: return(0x2500); /* H line - Scan 5 */
- case 0xE317: return(0x2500); /* H line - Scan 7 */
- case 0xE319: return(0x2500); /* H line - Scan 9 */
- case 0xE320: return(0x2583); /* Quadrant LL */
- case 0xE321: return(0x2490); /* Quadrant LR */
- case 0xE322: return(0x258c); /* Quadrant UL */
- case 0xE323: return(0x2588); /* Quadrant UL and LL and LR */
- case 0xE324: return(0x2588); /* Quadrant UL and LR */
- case 0xE325: return(0x2588); /* Quadrant UL and LR */
- case 0xE326: return(0x2588); /* Quadrant UL and UR and LL */
- case 0xE327: return(0x2588); /* Quadrant UL and UR and LR */
- case 0xE328: return(0x2590); /* Quadrant UR */
- case 0xE329: return(0x2588); /* Quadrant UR and LL and LR */
- case 0xE400: return(0x221a); /* Radical symbol, small */
- case 0xE401: return(0x00bf); /* Reverse question mark */
- default: return((unsigned)0xfffd);
- }
- }
- int /* Unicode to CP437 substitutions */
- #ifdef CK_ANSIC
- tx_cpsub(USHORT c)
- #else
- tx_cpsub(c) USHORT c;
- #endif /* CK_ANSIC */
- {
- int x;
- if (c < 0x0080) /* ASCII */
- return((CHAR)(c & 0xff));
- if (c >= 0x0080 && c <= 0x0100) {
- switch (c) { /* Latin-1 */
- case 0x00A2: return(0x9b); /* Cent sign */
- case 0x00A3: return(156); /* Pound sign */
- case 0x00AC: return(170); /* Not symbol */
- case 0x00B0: return(248); /* Degree symbol */
- case 0x00B1: return(241); /* Plus or minus symbol */
- case 0x00B2: return(253); /* Superscript 2 */
- case 0x00B3: return(51); /* Superscript 3 */
- case 0x00B6: return(14); /* Pilcrow symbol */
- case 0x00B7: return(250); /* Center dot, small */
- case 0x00B9: return(49); /* Superscript 1 */
- case 0x00D0: return(68); /* Eth -> D */
- case 0x00D7: return(120); /* Multiplication symbol */
- case 0x00DE: return(84); /* Thorn -> T */
- case 0x00F0: return(100); /* eth -> eth */
- case 0x00F7: return(246); /* Division symbol */
- case 0x00FE: return(116); /* thorn -> t */
- default: return(0x13);
- }
- } else if (c >= 0x0100 && c <= 0x02ff) { /* Latin-2 etc */
- switch (c) {
- case 0x0103: return(97); /* a breve */
- case 0x0105: return(97); /* a ogonek */
- case 0x0107: /* c acute */
- case 0x010d: return(99); /* c caron */
- case 0x010f: /* d caron */
- case 0x0111: return(100); /* d with stroke */
- case 0x0119: /* e ogonek */
- case 0x011b: return(101); /* e caron */
- case 0x011f: return(103); /* g breve */
- case 0x0130: return(73); /* Capital I with Dot */
- case 0x0131: return(105); /* Dotless i */
- case 0x0132: return(89); /* IJ => Y */
- case 0x0133: return(152); /* ij -> y diaeresis */
- case 0x013a: /* l acute */
- case 0x013e: /* l caron */
- case 0x0142: return(108); /* l with stroke */
- case 0x0144: /* n acute */
- case 0x0148: return(110); /* n caron */
- case 0x0151: return(111); /* o double acute */
- case 0x0152: return(79); /* OE */
- case 0x0153: return(111); /* oe */
- case 0x0155: /* r acute */
- case 0x0159: return(114); /* r caron */
- case 0x015b: /* s acute */
- case 0x015f: /* s ogonek */
- case 0x0161: return(115); /* s caron */
- case 0x0163: /* t ogonek */
- case 0x0165: /* t caron */
- case 0x0167: return(116); /* t with stroke */
- case 0x016f: /* u ring */
- case 0x0171: return(117); /* u double acute */
- case 0x017a: /* z acute */
- case 0x017c: /* z dot above */
- case 0x017e: return(122); /* z caron */
- case 0x0192: return(159); /* Function-of symbol, Script f */
- case 0x01d0: return(105); /* i caron */
- case 0x02c7: /* caron -> UNK */
- case 0x02d8: return(0x13); /* breve -> UNK */
- case 0x02dd: return(34); /* Double acute -> Doublequote */
- default: return(0x13);
- }
- } else if (c >= 0x0300 && c <= 0x03ff) { /* Greek */
- switch (c) {
- case 0x0393: return(226); /* Uppercase Greek Gamma */
- case 0x0398: return(233); /* Uppercase Greek Theta */
- case 0x039B: return(235); /* Uppercase Greek Lambda */
- case 0x03A0: return(227); /* Uppercase Greek Pi */
- case 0x03A3: return(228); /* Uppercase Greek Sigma */
- case 0x03A4: return(0xEA); /* Omega */
- case 0x03A6: return(232); /* Uppercase Greek Phi */
- case 0x03A9: return(234); /* Uppercase Greek Omega */
- case 0x03B1: return(0xE0); /* alpha */
- case 0x03B2: return(0xE1); /* beta */
- case 0x03B3: return(226); /* Lowercase Greek gamma */
- case 0x03B4: return(0xEB); /* delta */
- case 0x03B5: return(238); /* Lowercase Greek epsilon */
- case 0x03B7: return(238); /* Lowercase Greek eta */
- case 0x03B8: return(233); /* Lowercase Greek theta */
- case 0x03B9: return(105); /* Lowercase Greek iota */
- case 0x03BA: return(107); /* Lowercase Greek kappa */
- case 0x03BB: return(235); /* Lowercase Greek lambda */
- case 0x03BC: return(230); /* Lowercase Greek mu */
- case 0x03C0: return(227); /* Lowercase Greek pi */
- case 0x03C3: return(229); /* Lowercase Greek sigma */
- case 0x03C4: return(231); /* Lowercase Greek tau */
- case 0x03C6: return(237); /* Lowercase Greek phi */
- case 0x03C7: return(120); /* Lowercase Greek chi */
- case 0x03C9: return(234); /* Lowercase Greek omega */
- default: return(0x13);
- }
- } else if (c >= 0x2000 && c <= 0x20ff) { /* Sub+Superscripts & Currency */
- switch (c) {
- case 0x203C: return(0x13); /* !! */
- case 0x2070: return(48); /* Superscript 0 */
- case 0x2074: return(52); /* Superscript 4 */
- case 0x2075: return(53); /* Superscript 5 */
- case 0x2076: return(54); /* Superscript 6 */
- case 0x2077: return(55); /* Superscript 7 */
- case 0x2078: return(56); /* Superscript 8 */
- case 0x2079: return(57); /* Superscript 9 */
- case 0x207a: return(43); /* Superscript + */
- case 0x207b: return(45); /* Superscript - */
- case 0x207F: return(252); /* Superscript n */
- case 0x2080: return(48); /* Subscript 0 */
- case 0x2081: return(49); /* Subscript 1 */
- case 0x2082: return(50); /* Subscript 2 */
- case 0x2083: return(51); /* Subscript 3 */
- case 0x2084: return(52); /* Subscript 4 */
- case 0x2085: return(53); /* Subscript 5 */
- case 0x2086: return(54); /* Subscript 6 */
- case 0x2087: return(55); /* Subscript 7 */
- case 0x2088: return(56); /* Subscript 8 */
- case 0x2089: return(57); /* Subscript 9 */
- case 0x208a: return(43); /* Subscript + */
- case 0x208b: return(45); /* Subscript - */
- case 0x20a7: return(0x93); /* Peseta */
- default:
- x = tx_punc(c); /* Various spaces, dashes, etc */
- return((x < 0) ? 0x13 : x);
- }
- } else if (c >= 0x2100 && c <= 0x21ff) { /* Arrows */
- switch (c) {
- case 0x2190: return(27); /* Arrow, left-pointing */
- case 0x2191: return(24); /* Arrow, up-pointing */
- case 0x2192: return(26); /* Arrow, right-pointing */
- case 0x2193: return(25); /* Arrow, down-pointing */
- case 0x2194: return(0x1d); /* Arrow, left-right */
- case 0x2195: return(0x12); /* Arrow, up-down */
- case 0x219F: return(0x18); /* Arrow, up, doublehead */
- case 0x21A1: return(0x19); /* Arrow, down, doublehead */
- case 0x21A8: return(0x17); /* Arrow, up-down with base */
- case 0x21D2: return(26); /* Implies symbol */
- case 0x21D4: return(29); /* If and only if symbol */
- case 0x21E4: return(0x1B); /* Arrow, left, to bar */
- case 0x21E5: return(0x1A); /* Arrow, right, to bar */
- case 0x21E8: return(0x10); /* Outline white right arrow */
- case 0x21E9: return(0x0f); /* Outline white down arrow */
- default: return(0x13);
- }
- } else if (c >= 0x2200 && c <= 0x22ff) { /* Math */
- switch (c) {
- case 0x2202: return(235); /* Partial differential symbol */
- case 0x2207: return(31); /* Nabla, Laplace operator */
- case 0x2208: return(0x33); /* (because of QNX misunderstanding) */
- case 0x221A: return(251); /* Radical symbol */
- case 0x221D: return(236); /* Proportional-to */
- case 0x221E: return(236); /* Infinity symbol */
- case 0x2227: return(30); /* Logical AND */
- case 0x2228: return(31); /* Logical OR */
- case 0x2229: return(239); /* Intersection symbol */
- case 0x222A: return(85); /* Union symbol */
- case 0x222B: return(244); /* Integral symbol */
- case 0x2234: return(254); /* Therefore symbol */
- case 0x223C: return(126); /* Centered tilde operator */
- case 0x2243: return(247); /* Asymptotically equals */
- case 0x2248: return(247); /* Almost equal to symbol */
- case 0x2260: return(88); /* Not equal symbol */
- case 0x2261: return(240); /* Identity symbol */
- case 0x2264: return(243); /* Less than or equal symbol */
- case 0x2265: return(242); /* Greater than or equal symbol */
- case 0x2282: return(40); /* Subset symbol */
- case 0x2283: return(41); /* Superset symbol */
- case 0x22A6: return(0xC3); /* Assertion symbol */
- default: return(0x13);
- }
- } else if (c >= 0x2300 && c <= 0x24ff) { /* Tech */
- switch (c) {
- case 0x2308: return(0xDA); /* Left ceiling */
- case 0x2309: return(0xBF); /* Right ceiling */
- case 0x230A: return(0xC0); /* Left floor */
- case 0x230B: return(0xD9); /* Right floor */
- case 0x2319: return(0x1C); /* Turned Not sign */
- case 0x2320: return(244); /* Integral symbol top */
- case 0x2321: return(245); /* Integral symbol bot */
- case 0x2329: return(60); /* BRA, large left angle bracket */
- case 0x232A: return(62); /* KET, large right angle bracket */
- case 0x2409: return(26); /* "HT" becomes right arrow */
- case 0x240A: return(25); /* "LF" becomes down arrow */
- case 0x240B: return(23); /* "VT" becomes up-down arrow */
- case 0x240C: return(24); /* "FF" becomes up arrow */
- case 0x240D: return(27); /* "CR" becomes left arrow */
- case 0x2424: return(31); /* "NL" becomes down triangle */
- default: return(0x13);
- }
- } else if (c >= 0x2500 && c <= 0x2552) { /* Box drawing */
- switch (c) {
- case 0x2500: return(196); /* Center box bar horizontal */
- case 0x2501: return(0xCD); /* Bold -> Double */
- case 0x2502: return(179); /* Center box bar vertical */
- case 0x2503: return(0xBA); /* Bold */
- case 0x2504: return(45); /* Dashed line */
- case 0x2506: return(124); /* Broken vertical bar */
- case 0x250C: return(218); /* UL box corner */
- case 0x250F: return(0xC9); /* Bold */
- case 0x2510: return(191); /* UR Box Corner */
- case 0x2513: return(0xBB); /* Bold */
- case 0x2514: return(192); /* LL box corner */
- case 0x2517: return(0xC8); /* Bold */
- case 0x2518: return(217); /* LR box corner */
- case 0x251B: return(0xBC); /* Bold */
- case 0x251C: return(195); /* Left middle box side */
- case 0x2520: return(0xC3);
- case 0x2523: return(0xCC); /* Bold */
- case 0x2524: return(180); /* Right middle box side */
- case 0x2528: return(180);
- case 0x252B: return(0xB9); /* Bold */
- case 0x252C: return(194); /* Middle box top */
- case 0x252F: return(194);
- case 0x2533: return(0xCB); /* Bold */
- case 0x2534: return(193); /* Middle box bot */
- case 0x2537: return(193);
- case 0x253B: return(0xCA); /* Bold */
- case 0x253C: return(197); /* Box intersection */
- case 0x253F: return(197);
- case 0x2542: return(197);
- case 0x2547: return(197);
- case 0x2548: return(197);
- case 0x2549: return(197);
- case 0x254A: return(197);
- case 0x254B: return(0xCE); /* Bold */
- case 0x2550: return(205); /* Center box bar horizontal double */
- case 0x2551: return(186); /* Center box bar vertical double */
- case 0x2552: return(213); /* UL box corner single to double */
- default: return(0x13);
- }
- } else if (c >= 0x2553 && c <= 0x2579) { /* More box drawing */
- switch (c) {
- case 0x2553: return(214); /* UL box corner double to single */
- case 0x2554: return(201); /* UL box corner double */
- case 0x2555: return(184); /* UR box corner double to single */
- case 0x2556: return(183); /* UR box corner single to double */
- case 0x2557: return(187); /* UR box corner double */
- case 0x2558: return(212); /* LL box corner single to double */
- case 0x2559: return(211); /* LL box corner double to single */
- case 0x255A: return(200); /* LL box corner double */
- case 0x255B: return(190); /* LR box corner double to single */
- case 0x255C: return(189); /* LR box corner single to double */
- case 0x255D: return(188); /* LR box corner double */
- case 0x255E: return(198); /* Left mid box side single to doubl */
- case 0x255F: return(199); /* Left mid box side double to singl */
- case 0x2560: return(204); /* Left middle box side double */
- case 0x2561: return(181); /* Right box side double to single */
- case 0x2562: return(182); /* Right box side single to double */
- case 0x2563: return(185); /* Right middle box side double */
- case 0x2564: return(209); /* Middle box top double to single */
- case 0x2565: return(210); /* Middle box top single to double */
- case 0x2566: return(203); /* Middle box top double */
- case 0x2567: return(207); /* Middle box bot single to double */
- case 0x2568: return(208); /* Middle box bot double to single */
- case 0x2569: return(202); /* Middle box bot double */
- case 0x256A: return(216); /* Box intersection double to single */
- case 0x256B: return(215); /* Box intersection single to double */
- case 0x256C: return(206); /* Box intersection double */
- case 0x256D: return(218); /* UL arc */
- case 0x256E: return(191); /* UR arc */
- case 0x256F: return(217); /* LR arc */
- case 0x2570: return(192); /* LL arc */
- case 0x2571: return(179); /* Diagonal line LL to UR */
- case 0x2572: return(196); /* Diagonal line UL to LR */
- case 0x2573: return(88); /* Diagonal lines crossed */
- case 0x2575: return(0xb3); /* High vertical line */
- case 0x2576: return(45); /* Short horizontal line */
- case 0x2577: return(0xb3); /* Low vertical line */
- case 0x2579: return(0xb3); /* High vertical line bold */
- default: return(0x13);
- }
- } else if (c >= 0x257a && c <= 0x25ff) { /* Still more box drawing */
- switch (c) {
- case 0x257b: return(0xb3); /* Low vertical line bold */
- case 0x2580: return(223); /* Quadrant UL and UR (top half) */
- case 0x2581: return(0xc4); /* Scan line 9 */
- case 0x2582: return(0xDC); /* Black blob lower half */
- case 0x2584: return(220); /* Quadrant LL and LR (lower half) */
- case 0x2588: return(219); /* Fill character dark */
- case 0x258C: return(221); /* Quadrant UL and LL (left half) */
- case 0x258E: return(0xDD);
- case 0x2590: return(222); /* Quadrant UR and LR (right half) */
- case 0x2591: return(176); /* Fill character light */
- case 0x2592: return(177); /* Fill character medium */
- case 0x2593: return(178); /* Fill character heavy */
- case 0x2594: return(0xc4); /* Scan line 1 */
- case 0x25A0: return(254); /* Solid square, center */
- case 0x25A6: return(177); /* Blotch */
- case 0x25AC: /* Black rectangle */
- case 0x25AF: return(0x16); /* White rectangle */
- case 0x25B2: /* Triangle, up-pointing */
- case 0x25B4: return(0x1e); /* Triangle, up-pointing */
- case 0x25B6: /* Triangle, right-pointing, dark */
- case 0x25B7: /* Triangle, right-pointing, light */
- case 0x25B9: /* Triangle, right-pointing, light */
- case 0x25BA: return(0x10); /* Triangle, right-pointing, narrow */
- case 0x25BC: /* Triangle, down-pointing */
- case 0x25BE: return(0x1f); /* Triangle, down-pointing */
- case 0x25C0: /* Triangle, left-pointing, dark */
- case 0x25C1: /* Triangle, left-pointing, dark */
- case 0x25C4: return(0x11); /* Triangle, left-pointing, narrow */
- case 0x25C6: return(4); /* Diamond, center, solid */
- case 0x25CB: return(0x09); /* Circle */
- case 0x25CF: return(249); /* Center dot, large */
- case 0x25d8: return(0x08); /* Inverse bullet */
- case 0x25d9: return(0x0a); /* Inverse white circle */
- case 0x25E2: return(0xD9); /* Lower right triangle */
- case 0x25E3: return(0xC0); /* Lower left triangle */
- case 0x25E4: return(0xDA); /* Upper left triangle */
- case 0x25E5: return(0xBf); /* Upper right triangle */
- default: return(0x13);
- }
- } else if (c >= 0x2600) { /* All the rest */
- switch (c) {
- case 0x263a: return(0x01); /* Smiley */
- case 0x263b: return(0x02); /* Inverse Smiley */
- case 0x263c: return(0x0f); /* White Sun with Rays */
- case 0x2640: return(0x0c); /* Male sign */
- case 0x2642: return(0x0b); /* Female sign */
- case 0x2660: return(0x06); /* Spade */
- case 0x2663: return(0x05); /* Club */
- case 0x2665: return(0x03); /* Heart */
- case 0x2666: return(0x04); /* Diamond, center, solid */
- case 0x266a: return(0x0d); /* Quarter note */
- case 0x266b: /* Beamed quarter notes */
- case 0x266c: return(0x0e); /* Beamed 8th notes */
- case 0x279e: return(0x1a); /* Bold right arrow */
- case 0x27a1: return(0x1a); /* Heavy black right arrow. */
- case 0xE200: return(180); /* Extensible left brace middle */
- case 0xE201: return(192); /* Extensible Left parenthesis bot */
- case 0xE202: return(218); /* Extensible left parenthesis top */
- case 0xE203: return(192); /* Extensible left SB bot */
- case 0xE204: return(218); /* Extensible left SB top */
- case 0xE205: return(195); /* Extensible right brace middle */
- case 0xE206: return(217); /* Extensible right parenthesis bot */
- case 0xE207: return(191); /* Extensible right parenthesis top */
- case 0xE208: return(217); /* Extensible right SB bot */
- case 0xE209: return(191); /* Extensible right SB top */
- case 0xE20C: return(228); /* Summation symbol bot */
- case 0xE20D: return(228); /* Summation symbol top */
- case 0xE20E: return(191); /* Right ceiling corner */
- case 0xE20F: return(217); /* Right floor corner */
- case 0xE300: return(179); /* V box line, extensible, left */
- case 0xE309: return(179); /* V box line, extensible, right */
- case 0xE30A: return(221); /* Diagonal fill, dark, UL */
- case 0xE30B: return(222); /* Diagonal fill, dark, UR */
- case 0xE311: return(196); /* H line - Scan 1 */
- case 0xE313: return(196); /* H line - Scan 3 */
- case 0xE315: return(196); /* H line - Scan 5 */
- case 0xE317: return(196); /* H line - Scan 7 */
- case 0xE319: return(196); /* H line - Scan 9 */
- case 0xE320: return(221); /* Quadrant LL */
- case 0xE321: return(222); /* Quadrant LR */
- case 0xE322: return(221); /* Quadrant UL */
- case 0xE323: return(219); /* Quadrant UL and LL and LR */
- case 0xE324: return(219); /* Quadrant UL and LR */
- case 0xE325: return(219); /* Quadrant UL and LR */
- case 0xE326: return(219); /* Quadrant UL and UR and LL */
- case 0xE327: return(219); /* Quadrant UL and UR and LR */
- case 0xE328: return(222); /* Quadrant UR */
- case 0xE329: return(219); /* Quadrant UR and LL and LR */
- case 0xE400: return(251); /* Radical symbol, small */
- case 0xE401: return(168); /* Reverse question mark */
- case 0xFFFD: return(0x13); /* !! for unknown */
- default: return(0x13);
- }
- }
- return(0x13);
- }
- #ifdef OS2
- /*
- Lucida Console is a Unicode font, but it is very sparsely populated.
- Since it is the only monospace Unicode font most people have, we have
- to make reasonable substitutions or else 3/4 of the glyphs will show
- up as blobs on the screen.
- */
- USHORT /* Unicode to Lucida Console */
- #ifdef CK_ANSIC
- tx_lucidasub(USHORT c)
- #else
- tx_lucidasub(c) USHORT c;
- #endif /* CK_ANSIC */
- {
- if (c < 0x0180) /* Latin-1 and Extended A */
- return(c);
- /* For efficiency we try to arrange the sections by frequency of use. */
- if (c >= 0x2500 && c <= 0x257f) { /* Box drawing */
- if (c >= 0x2550 && c <= 0x256c)
- return(c);
- switch (c) {
- /* Themselves */
- case 0x2500:
- case 0x2502:
- case 0x250c:
- case 0x2510:
- case 0x2514:
- case 0x2518:
- case 0x251c:
- case 0x2524:
- case 0x252c:
- case 0x2534:
- case 0x253c:
- return(c);
- /* Horizontal lines */
- case 0x2501: /* Bold */
- return(0x2550); /* Use double */
- case 0x2504:
- case 0x2505:
- case 0x2508:
- case 0x2509:
- case 0x254c:
- case 0x254d:
- case 0x257c:
- case 0x257e:
- return(0x2500);
- /* Vertical lines */
- case 0x2503: /* Bold */
- return(0x2551); /* Use double */
- case 0x2506:
- case 0x2507:
- case 0x250a:
- case 0x250b: /* Other */
- case 0x254e:
- case 0x254f:
- case 0x257d:
- case 0x257f:
- case 0x2575:
- case 0x2577:
- case 0x2579:
- case 0x257b:
- return(0x2502);
- /* Upper left box corner */
- case 0x250f: /* Bold */
- return(0x2554); /* Use double */
- case 0x250d: case 0x250e: /* Other */
- return(0x250c);
- /* Upper right box corner */
- case 0x2513: /* Bold */
- return(0x2557);
- case 0x2511:
- case 0x2512: /* Other */
- return(0x2510);
- /* Lower left box corner */
- case 0x2517: /* Bold */
- return(0x255a);
- case 0x2515:
- case 0x2516: /* Other */
- return(0x2514);
- /* Lower right box corner */
- case 0x251b: /* Bold */
- return(0x255d);
- case 0x2519:
- case 0x251a: /* Other */
- return(0x2518);
- /* Vertical and right */
- case 0x2523: /* Bold */
- return(0x2560);
- case 0x251d:
- case 0x251e:
- case 0x251f:
- case 0x2520:
- case 0x2521:
- case 0x2522:
- return(0x251c);
- /* Vertical and left */
- case 0x252b: /* Bold */
- return(0x2563);
- case 0x2525:
- case 0x2526:
- case 0x2527:
- case 0x2528:
- case 0x2529:
- case 0x252a:
- return(0x2524);
- /* Horizontal and down */
- case 0x2533: /* Bold */
- return(0x2566);
- case 0x252d:
- case 0x252e:
- case 0x252f:
- case 0x2530:
- case 0x2531:
- case 0x2532:
- return(0x252c);
- /* Horizontal and up */
- case 0x253b: /* Bold */
- return(0x2569);
- case 0x2535: case 0x2536: case 0x2537:
- case 0x2538: case 0x2539: case 0x253a:
- return(0x2534);
- /* Horizontal and Vertical */
- case 0x254b: /* Bold */
- return(0x256c);
- case 0x253d: case 0x253e: case 0x253f:
- case 0x2540: case 0x2541: case 0x2542: case 0x2543:
- case 0x2544: case 0x2545: case 0x2546: case 0x2547:
- case 0x2548: case 0x2549: case 0x254a:
- return(0x253c);
- /* Curved corners */
- case 0x256d: /* UL */
- return(0x250c);
- case 0x256e: /* UR */
- return(0x2510);
- case 0x256f: /* LL */
- return(0x2518);
- case 0x2570: /* LR */
- return(0x2514);
- case 0x2571: /* Diagonal */
- return(0x002f);
- case 0x2572: /* Other diagonal */
- return(0x005c);
- case 0x2573: /* Diagonal cross */
- return(0x00d7);
- /* Partial horizontal lines */
- case 0x2574: case 0x2576: case 0x2578: case 0x257a:
- return(0x002d);
- default:
- return(0xfffd);
- }
- }
- if (c >= 0x2190 && c <= 0x21ff) { /* Arrows */
- if (c >= 0x2190 && c <= 0x2195 || c == 0x21a8)
- return(c);
- switch (c) {
- /* Left-arrow forms */
- case 0x219e: case 0x21a2: case 0x21a4: case 0x21a9:
- case 0x21bc: case 0x21d0: case 0x21da: case 0x21dc:
- case 0x21e0: case 0x21e4: case 0x21e6: case 0x21c7:
- return(0x2190);
- /* Right-arrow forms */
- case 0x21a0: case 0x21a3: case 0x21a6: case 0x21aa:
- case 0x21c0: case 0x21c1: case 0x21c9: case 0x21d2:
- case 0x21db: case 0x21dd: case 0x21e2: case 0x21e5:
- case 0x21e8:
- return(0x2192);
- /* Up-arrow forms */
- case 0x219f: case 0x21a5: case 0x21be: case 0x21bf:
- case 0x21c8: case 0x21d1: case 0x21de: case 0x21e1:
- case 0x21e7: case 0x21ea:
- return(0x2191);
- /* Down-arrow forms */
- case 0x21a1: case 0x21a7: case 0x21af: case 0x21c2:
- case 0x21ce: case 0x21ca: case 0x21d3: case 0x21df:
- case 0x21e3: case 0x21e9:
- return(0x2193);
- /* Up-down-arrow forms */
- case 0x21c5: case 0x21d5:
- return(0x2195);
- default:
- return(0xfffd);
- }
- }
- if (c >= 0x2580 && c <= 0x259f) { /* Block elements */
- switch (c) {
- case 0x2580: case 0x2584: case 0x2588: case 0x258c:
- case 0x2590: case 0x2591: case 0x2592: case 0x2593:
- return(c);
- case 0x2581: case 0x2582: case 0x2583:
- case 0x2585: case 0x2586: case 0x2587:
- return(0x2584);
- case 0x2589: case 0x258a: case 0x258b:
- case 0x258d: case 0x258e: case 0x258f:
- return(0x258c);
- case 0x2595:
- return(0x2502);
- default:
- return(0xfffd);
- }
- }
- if (c >= 0x2200 && c <= 0x22ff) { /* Mathematical operators */
- switch (c) {
- case 0x2202: case 0x2206: case 0x220f: case 0x2211: case 0x2212:
- case 0x2219: case 0x2220: case 0x221e: case 0x221f: case 0x2229:
- case 0x222b: case 0x2248: case 0x2260: case 0x2261: case 0x2264:
- case 0x2265:
- return(c);
- default:
- return(0xfffd);
- }
- }
- if (c >= 0x2300 && c <= 0x237f) { /* Miscellaneous Technical */
- if (c == 0x2302 || c == 0x2310 || c == 0x2320 || c == 0x2321)
- return(c);
- switch (c) {
- case 0x2329: /* BRA */
- return(0x003c);
- case 0x232a: /* KET */
- return(0x003e);
- default:
- return(0xfffd);
- }
- }
- if (c >= 0x25a0 && c <= 0x25ff) { /* Geometric shapes */
- switch (c) {
- /* Themselves */
- case 0x25a0: case 0x25ac: case 0x25b2: case 0x25ba:
- case 0x25bc: case 0x25c4: case 0x25ca: case 0x25cb:
- case 0x25d8: case 0x25d9:
- return(c);
- /* Squares */
- case 0x25a1: case 0x25a2: case 0x25a3: case 0x25a4:
- case 0x25a5: case 0x25a6: case 0x25a7: case 0x25a8:
- case 0x25a9: case 0x25aa: case 0x25ab:
- case 0x25e7: case 0x25e8: case 0x25e9: case 0x25ea: case 0x25eb:
- return(0x25a0);
- case 0x25ad: case 0x25ae: case 0x25af: /* Rectangles */
- case 0x25b0: case 0x25b1:
- return(0x25ac);
- case 0x25b3: case 0x25b4: case 0x25b5: /* Upright triangles */
- case 0x25ec: case 0x25ed: case 0x25ee:
- return(0x25b2);
- case 0x25b6: case 0x25b7: case 0x25b8: case 0x25b9: case 0x25bb:
- return(0x25ba); /* Right-pointing triangles */
- case 0x25bd: case 0x25be: case 0x25bf: /* Down-pointing triangles */
- return(0x25bc);
- case 0x25c0: case 0x25c1: case 0x25c2: case 0x25c3: case 0x25c5:
- return(0x25c4); /* Left-pointing triangles */
- case 0x25c6: case 0x25c7: case 0x25c8: /* Diamonds */
- return(0x2666);
- /* Circles */
- case 0x25c9: case 0x25cc: case 0x25cd: case 0x25ce: case 0x25cf:
- case 0x25d0: case 0x25d1: case 0x25d2: case 0x25d3: case 0x25d4:
- case 0x25d5: case 0x25e6: case 0x25ef:
- return(0x25cb);
- /* Curves and corner triangles */
- case 0x25dc: case 0x25e4: /* UL */
- return(0x250c);
- case 0x25dd: case 0x25e5: /* UR */
- return(0x2510);
- case 0x25df: case 0x25e3: /* LL */
- return(0x2514);
- case 0x25de: case 0x25e2: /* LR */
- return(0x2518);
- default:
- return(0xfffd);
- }
- }
- if (c >= 0x2600 && c <= 0x26ff) { /* Misc symbols */
- switch (c) {
- /* Themselves */
- case 0x263a: case 0x263b: case 0x263c: case 0x2640:
- case 0x2642: case 0x2660: case 0x2663: case 0x2665:
- case 0x2666: case 0x266a: case 0x266b:
- return(c);
- default:
- return(0xfffd);
- }
- }
- if (c >= 0x2794 && c <= 0x27be) /* Right-arrow Dingbats */
- return(0x2192);
- if (c >= 0x2070 && c <= 0x209f) { /* Super & subscripts */
- if (c == 0x207f) /* n */
- return(c);
- else if (c == 0x2070) /* 0 */
- return(0x0030);
- else if (c >= 0x2074 && c <= 0x2079)
- return(c - 0x2040);
- else if (c >= 0x2080 && c <= 0x2089)
- return(c - 0x2050);
- switch (c) {
- case 0x207a: case 0x208a:
- return(0x002b);
- case 0x207b: case 0x208b:
- return(0x002d);
- case 0x207c: case 0x208c:
- return(0x003d);
- case 0x207d: case 0x208d:
- return(0x0028);
- case 0x207e: case 0x208e:
- return(0x0029);
- default:
- return(0xfffd);
- }
- }
- if (c >= 0x0180 && c <= 0x024f) { /* Latin Extended B, Part I */
- if (c == 0x0192 || c >= 0x01fa && c <= 0x01ff)
- return(c); /* Latin Extended B */
- switch (c) {
- case 0x0180: case 0x0183: case 0x0184: case 0x0185:
- return(0x0062); /* Lowercase b variants */
- case 0x0181: case 0x0182:
- return(0x0042); /* Uppercase B variants */
- case 0x0186: case 0x0187:
- return(0x0043); /* Uppercase C variants */
- case 0x0189: /* D with stroke */
- return(0x00D0); /* Looks just like Eth */
- case 0x018a: /* D with hook */
- return(0x0044);
- case 0x018e: case 0x0190: /* E-like letters */
- return(0x0045);
- case 0x018f: /* e-like letters */
- return(0x0065);
- case 0x0191: /* F-like */
- return(0x0046);
- case 0x0193: /* G-like */
- return(0x0047);
- case 0x0194: /* Latin Capital Gamma */
- return(0x0393); /* Use Greek */
- case 0x0195: /* Gothic hv */
- return(0x0068); /* Use h */
- case 0x0196: /* Latin Capital Iota */
- return(0x0399); /* Use Greek */
- case 0x0197: /* I with bar */
- return(0x0069);
- case 0x0198: /* K with hook */
- return(0x004B);
- case 0x0199: /* k with hook */
- return(0x006B);
- case 0x019A: /* l with bar */
- return(0x006C);
- case 0x019B: /* lambda with bar */
- return(0x03bb); /* Use Greek */
- case 0x019C: /* Upside down m */
- return(0x006d);
- case 0x019D: /* N with left hook */
- return(0x004e);
- case 0x019E: /* n with long right leg */
- return(0x006e);
- case 0x019F: case 0x01a0: case 0x01a2: /* O-like letters */
- return(0x004f);
- case 0x01a1: case 0x01a3: /* o-like */
- return(0x006f);
- case 0x01A4: /* P with hook */
- return(0x0050);
- case 0x01A5: /* p with hook */
- return(0x0070);
- case 0x01A6: /* Old Norse YR */
- return(0x0052);
- case 0x01A7: /* Backwards S */
- return(0x0053);
- case 0x01A8: case 0x01AA: /* s-like letters */
- return(0x0073);
- case 0x01A9: /* Esh */
- return(0x03a3); /* Looks just like Sigma */
- case 0x01AB: case 0x01AD: /* t-like */
- return(0x0074);
- case 0x01AC: case 0x01AE: /* T-like */
- return(0x0054);
- case 0x01AF: case 0x01B1: /* U-like */
- return(0x0055);
- case 0x01B0: /* u-like */
- return(0x0075);
- case 0x01B2: /* V-like */
- return(0x0056);
- case 0x01B3: /* Y-like */
- return(0x0059);
- case 0x01B4: /* y-like */
- return(0x0079);
- case 0x01B5: /* Z-like */
- return(0x005a);
- case 0x01B6: /* z-like */
- return(0x007a);
- case 0x01B7: /* Yogh */
- return(0x0033); /* Use "3" */
- case 0x01BF: /* Wynn */
- return(0x0077); /* Use "w" */
- case 0x01CD: /* A caron */
- return(0x0041);
- case 0x01CE: /* a caron */
- return(0x0061);
- case 0x01CF: /* I caron */
- return(0x0049);
- case 0x01D0: /* i caron */
- return(0x0069);
- case 0x01D1: /* O caron */
- return(0x004f);
- case 0x01D2: /* o caron */
- return(0x006f);
- case 0x01D3: /* U caron */
- return(0x0055);
- case 0x01D4: /* u caron */
- return(0x0075);
- /* U diaeresis + other things */
- case 0x01D5: case 0x01D7: case 0x01D9: case 0x01DB:
- return(0x00dc);
- /* u diaeresis + other things */
- case 0x01D6: case 0x01Da: case 0x01Dc:
- return(0x00fc);
- /* Fill in more here if anybody asks */
- default:
- return(0xfffd);
- }
- }
- if (c >= 0x1e00 && c <= 0x1eff) { /* Latin Extended Additional */
- if (c >= 0x1e80 && c <= 0x1e85)
- return(c);
- else
- return(0xfffd);
- }
- if (c >= 0x0400 && c <= 0x04ff) { /* Cyrillic */
- if (c >= 0x0400 && c <= 0x045f || c == 0x0490 || c == 0x0491)
- return(c);
- else
- return(0xfffd);
- }
- if (c >= 0x0370 && c <= 0x03ff) { /* Greek */
- if (c == 0x037e || c >= 0x0384 && c <= 0x03ce)
- return(c);
- switch (c) {
- case 0x0374: case 0x0375:
- return(0x0027);
- case 0x037a:
- return(0x002c);
- /* Fill in more here if needed */
- default:
- return(0xfffd);
- }
- }
- if (c >= 0x1f00 && c <= 0x1fff) { /* Greek Extended */
- /* Fill in if asked */
- return(0xfffd);
- }
- if (c >= 0x20a0 && c <= 0x20cf) { /* Currency symbols */
- if (c == 0x20a3 || c == 0x20a4 || c == 0x20a7 || c == 0x20ac)
- return(c);
- else
- return(0xfffd);
- }
- if (c >= 0x2100 && c <= 0x214f) { /* Letterlike symbols */
- if (c == 0x2116 || c == 0x2122 || c == 0x2126)
- return(c);
- else
- return(0xfffd);
- }
- if (c >= 0x2150 && c <= 0x218f) { /* Number forms */
- if (c >= 0x215b && c <= 0x215e) /* Roman numerals etc */
- return(c);
- else
- return(0xfffd);
- }
- if (c >= 0x02b0 && c <= 0x02ff) { /* Spacing modifier letters */
- if (c == 0x02c6 || c == 0x02c7 || c == 0x02c9 ||
- c >= 0x02d8 && c <= 0x02dd)
- return(c);
- switch (c) {
- case 0x02b0: case 0x02b1:
- return(0x0068);
- case 0x02b2:
- return(0x006a);
- case 0x02b3: case 0x02b4: case 0x02b5:
- return(0x0072);
- case 0x02b7:
- return(0x0077);
- case 0x02b8:
- return(0x0079);
- case 0x02b9:
- return(0x00b4);
- case 0x02ba:
- return(0x0022);
- case 0x02bb: case 0x02bc: case 0x02bd: case 0x02be: case 0x02bf:
- return(0x0027);
- case 0x02c2: return(0x003c);
- case 0x02c3: return(0x003e);
- case 0x02da: return(0x00b0);
- case 0x02dc: return(0x007e);
- default: return(0xfffd);
- }
- }
- if (c >= 0x2000 && c <= 0x206f) { /* General Punctuation */
- if (c >= 0x2013 && c <= 0x2015 ||
- c >= 0x2017 && c <= 0x201a ||
- c >= 0x201c && c <= 0x201e ||
- c >= 0x2020 && c <= 0x2022 || c == 0x2026 || c == 0x2030 ||
- c >= 0x2039 && c <= 0x203a || c == 0x203c || c == 0x203e ||
- c == 0x2044)
- return(c);
- else if (c == 0x2016)
- return(0x2551);
- else if (c == 0x2017)
- return(0x2550);
- else if (c == 0x2044)
- return(0x002f);
- else
- return(0xfffd);
- }
- if (c == 0xfb01 || c == 0xfb02) /* Alphabetic Presentation Forms */
- return(c);
- return(0xfffd); /* Catch-all */
- }
- #endif /* OS2 */
- /*
- Table of Blah-to-Unicode information structures.
- KEEP THIS IN SYNC WITH THE TX_blah DEFINITIONS in ckcuni.h.
- */
- struct x_to_unicode *
- txrinfo[MAXTXSETS+1] = {
- &u_ascii, /* 0 US ISO 646 (ASCII) */
- &u_british, /* 1 UK ISO 646 */
- &u_fr_canadian, /* 2 Canadian French NRC */
- NULL, /* 3 Cuba */
- NULL, /* 4 Czecho */
- &u_danish, /* 5 Danish/Norwegian ISO 646 */
- &u_dutch, /* 6 Dutch NRC */
- &u_finnish, /* 7 Finnish NRC */
- &u_french, /* 8 French ISO 646 */
- &u_german, /* 9 German ISO 646 */
- &u_hebrew7, /* 10 Hebrew-7 (DEC) */
- &u_hungarian, /* 11 Hungarian ISO 646 */
- &u_icelandic, /* 12 Icelandic NRC */
- &u_italian, /* 13 Italian ISO 646 */
- &u_jis0201r, /* 14 Japanese Roman ISO 646 */
- &u_jis0201k, /* 15 Japanese Katakana */
- &u_koi7, /* 16 Short KOI */
- &u_danish, /* 17 Norwegian/Danish ISO 646 */
- &u_portuguese, /* 18 Portuguese ISO 646 */
- &u_spanish, /* 19 spanish ISO 646 */
- &u_swedish, /* 20 Swedish ISO 646 */
- NULL, /* 21 Swedish ISO 646 for names */
- &u_swiss, /* 22 Swiss NRC */
- &u_8859_1, /* 23 ISO 8859-1 */
- &u_8859_2, /* 24 ISO 8859-2 */
- &u_8859_3, /* 25 ISO 8859-3 */
- &u_8859_4, /* 26 ISO 8859-4 */
- &u_8859_5, /* 27 ISO 8859-5 */ /* Cyrillic */
- &u_8859_6, /* 28 ISO 8859-6 */ /* Arabic */
- &u_8859_7, /* 29 ISO 8859-7 */ /* Greek */
- &u_8859_8, /* 30 ISO 8859-8 */ /* Hebrew */
- &u_8859_9, /* 31 ISO 8859-9 */
- &u_8859_10, /* 32 ISO 8859-10 */
- &u_koi8, /* 33 KOI-8 */
- NULL, /* 34 JIS-7 */
- NULL, /* 35 Shift JIS */
- NULL, /* 36 Japanese EUC (JAE) */
- NULL, /* 37 Japanese DEC Kanji */
- &u_decmcs, /* 38 DEC MCS */
- &u_nextstep, /* 39 NeXT */
- &u_dgi, /* 40 DGI */
- &u_maclatin, /* 41 Macintosh Latin */
- &u_hproman8, /* 42 HP Roman 8 */
- &u_cp437, /* 43 CP437 - Original */
- &u_cp850, /* 44 CP850 - W Europe */
- &u_cp852, /* 45 CP852 - E Europe */
- &u_cp857, /* 46 CP857 - Turkish */
- &u_cp862, /* 47 CP862 - Hebrew */
- &u_cp864, /* 48 CP864 - Arabic */
- &u_cp866, /* 49 CP866 - Cyrillic */
- &u_cp869, /* 50 CP869 - Greek */
- &u_decspec, /* 51 DEC Special Graphics */
- &u_dectech, /* 52 DEC Technical */
- &u_c0pics, /* 53 C0 Pictures */
- &u_c1pics, /* 54 C1 Pictures */
- &u_smiley, /* 55 IBM C0 Graphics */
- &u_heath19g, /* 56 Heath 19 Graphics */
- &u_tvig, /* 57 TVI Graphics */
- &u_wyse_gn, /* 58 Wyse 60 Graphics Normal */
- &u_wyse_g1, /* 59 Wyse 60 Graphics 1 */
- &u_wyse_g2, /* 60 Wyse 60 Graphics 2 */
- &u_wyse_g3, /* 61 Wyse 60 Graphics 3 */
- &u_elot927, /* 62 Greek ELOT 927 */
- &u_dgspec, /* 63 DG Special graphics */
- &u_dgline, /* 64 DG Line drawing */
- &u_dgword, /* 65 DG Word processing */
- &u_hpline, /* 66 HP Line drawing */
- &u_hpmath, /* 67 HP Math/Technical */
- &u_qnxgrph, /* 68 QNX Graphics */
- &u_snibrack, /* 69 SNI Brackets */
- &u_snieuro, /* 70 SNI Euro */
- &u_snifacet, /* 71 SNI Facet */
- &u_sniibm, /* 72 SNI IBM */
- &u_sniblanks, /* 73 SNI Blanks */
- &u_cp1252, /* 74 Windows Latin-1 */
- &u_cp1250, /* 75 Windows Latin-2 */
- &u_cp1251, /* 76 Windows Cyrillic */
- &u_cp1253, /* 77 Windows Greek */
- &u_cp1254, /* 78 Windows Turkish */
- &u_cp1257, /* 79 Windows Latin-4 */
- &u_cp856, /* 80 Cyrillic PC Code Page 856 */
- &u_cp855, /* 81 Cyrillic PC Code Page 855 */
- &u_8859_1, /* 82 CP819 - Same as 8859-1 */
- &u_8859_2, /* 83 CP912 - Same as 8859-2 */
- &u_8859_3, /* 84 CP913 - Same as 8859-3 */
- &u_8859_4, /* 85 CP914 - Same as 8859-4 */
- &u_8859_5, /* 86 CP915 - Same as 8859-5 */
- &u_8859_6, /* 87 CP1089 - Same as 8859-6 */
- &u_8859_7, /* 88 CP813 - Same as 8859-7 */
- &u_8859_8, /* 89 CP916 - Same as 8859-8 */
- &u_8859_9, /* 90 CP920 - Same as 8859-9 */
- &u_hproman8, /* 91 CP1051 - Same as HP Roman 8 */
- &u_cp858, /* 92 CP858 - W Europe w/Euro */
- &u_8859_15, /* 93 ISO 8859-15 Latin-15 */
- &u_8859_15, /* 94 CP923 - Same as 8859-15 */
- &u_8859_7, /* 95 ELOT928 - Same as 8859-7 */
- &u_quickdraw, /* 96 CP10000 - Apple Quickdraw */
- &u_cp37, /* 97 CP37 - U.S. EBCDIC */
- &u_cp1255, /* 98 CP1255 - Windows Hebrew */
- &u_cp1256, /* 99 CP1256 - Windows Arabic */
- &u_cp1258, /* 100 CP1258 - Windows Viet Nam */
- &u_mazovia, /* 101 Mazovia Polish code page */
- &u_transparent, /* 102 Transparent */
- &u_hz1500, /* 103 Hazeltine 1500/1520 graphics */
- &u_koi8r, /* 104 KOI8-R */
- &u_koi8u /* 105 KOI8-U */
- };
- /*
- Table of Blah-to-Unicode translation functions.
- KEEP THIS IN SYNC WITH THE TX_blah DEFINITITIONS in ckcuni.h.
- */
- USHORT
- #ifdef CK_ANSIC
- (*xl_u[MAXTXSETS+1])(CHAR)
- #else
- (*xl_u[MAXTXSETS+1])()
- #endif /* CK_ANSIC */
- = {
- ascii_u, /* 0 US ISO 646 (ASCII) */
- british_u, /* 1 UK ISO 646 */
- fr_canadian_u, /* 2 Canadian French NRC */
- NULL, /* 3 Cuba */
- NULL, /* 4 Czecho */
- danish_u, /* 5 Danish/Norwegian ISO 646 */
- dutch_u, /* 6 Dutch NRC */
- finnish_u, /* 7 Finnish NRC */
- french_u, /* 8 French ISO 646 */
- german_u, /* 9 German ISO 646 */
- hebrew7_u, /* 10 Hebrew-7 (DEC) */
- hungarian_u, /* 11 Hungarian ISO 646 */
- icelandic_u, /* 12 Icelandic */
- italian_u, /* 13 Italian ISO 646 */
- jis0201r_u, /* 14 Japanese Roman ISO 646 */
- jis0201k_u, /* 15 Japanese Katakana */
- koi7_u, /* 16 Short KOI */
- danish_u, /* 17 Norwegian/Danish ISO 646 */
- portuguese_u, /* 18 Portuguese ISO 646 */
- spanish_u, /* 19 spanish ISO 646 */
- swedish_u, /* 20 Swedish ISO 646 */
- NULL, /* 21 Swedish ISO 646 for names */
- swiss_u, /* 22 Swiss NRC */
- iso_8859_1_u, /* 23 ISO 8859-1 */
- iso_8859_2_u, /* 24 ISO 8859-2 */
- iso_8859_3_u, /* 25 ISO 8859-3 */
- iso_8859_4_u, /* 26 ISO 8859-4 */
- iso_8859_5_u, /* 27 ISO 8859-5 */ /* Cyrillic */
- iso_8859_6_u, /* 28 ISO 8859-6 */ /* Arabic */
- iso_8859_7_u, /* 29 ISO 8859-7 */ /* Greek */
- iso_8859_8_u, /* 30 ISO 8859-8 */ /* Hebrew */
- iso_8859_9_u, /* 31 ISO 8859-9 */ /* Latin-5 */
- iso_8859_10_u, /* 32 ISO 8859-10 */
- koi8_u, /* 33 KOI-8 */
- NULL, /* 34 JIS-7 */
- NULL, /* 35 Shift JIS */
- NULL, /* 36 Japanese EUC (JAE) */
- NULL, /* 37 Japanese DEC Kanji */
- decmcs_u, /* 38 DEC MCS */
- nextstep_u, /* 39 NeXT */
- dgi_u, /* 40 DGI */
- maclatin_u, /* 41 Macintosh Latin */
- hproman8_u, /* 42 HP Roman 8 */
- cp437_u, /* 43 CP437 - Original */
- cp850_u, /* 44 CP850 - W Europe */
- cp852_u, /* 45 CP852 - E Europe */
- cp857_u, /* 46 CP857 - Turkish */
- cp862_u, /* 47 CP862 - Hebrew */
- cp864_u, /* 48 CP864 - Arabic */
- cp866_u, /* 49 CP866 - Cyrillic */
- cp869_u, /* 50 CP869 - Greek */
- decspec_u, /* 51 DEC Special Graphics */
- dectech_u, /* 52 DEC Technical */
- c0pics_u, /* 53 C0 Pictures */
- c1pics_u, /* 54 C1 Pictures */
- smiley_u, /* 55 IBM C0 Graphics */
- heath19g_u, /* 56 Heath 19 graphics */
- tvig_u, /* 57 TVI graphics */
- wyse_gn_u, /* 58 Wyse 60 normal-mode graphics */
- wyse_g1_u, /* 59 Wyse 60 graphics 1 */
- wyse_g2_u, /* 60 Wyse 60 graphics 2 */
- wyse_g3_u, /* 61 Wyse 60 graphics 3 */
- elot927_u, /* 62 Greek ELOT 927 */
- dgspec_u, /* 63 DG Special graphics */
- dgline_u, /* 64 DG Line drawing */
- dgword_u, /* 65 DG Word processing */
- hpline_u, /* 66 HP Line drawing */
- hpmath_u, /* 67 HP Math/Technical */
- qnxgrph_u, /* 68 QNX Graphics */
- snibrack_u, /* 69 SNI Brackets */
- snieuro_u, /* 70 SNI Euro */
- snifacet_u, /* 71 SNI Facet */
- sniibm_u, /* 72 SNI IBM */
- sniblanks_u, /* 73 SNI Blanks */
- cp1252_u, /* 74 Windows Latin-1 */
- cp1250_u, /* 75 Windows Latin-2 */
- cp1251_u, /* 76 Windows Cyrillic */
- cp1253_u, /* 77 Windows Greek */
- cp1254_u, /* 78 Windows Turkish */
- cp1257_u, /* 79 Windows Latin-4 */
- cp856_u, /* 80 Cyrillic PC Code Page 856 */
- cp855_u, /* 81 Cyrillic PC Code Page 856 */
- iso_8859_1_u, /* 82 CP819 - Same as 8859-1 */
- iso_8859_2_u, /* 83 CP912 - Same as 8859-2 */
- iso_8859_3_u, /* 84 CP913 - Same as 8859-3 */
- iso_8859_4_u, /* 85 CP914 - Same as 8859-4 */
- iso_8859_5_u, /* 86 CP915 - Same as 8859-5 */
- iso_8859_6_u, /* 87 CP1089 - Same as 8859-6 */
- iso_8859_7_u, /* 88 CP813 - Same as 8859-7 */
- iso_8859_8_u, /* 89 CP916 - Same as 8859-8 */
- iso_8859_9_u, /* 90 CP920 - Same as 8859-9 */
- hproman8_u, /* 91 CP1051 -Same as HP Roman 8 */
- cp858_u, /* 92 CP858 - W Europe w/Euro */
- iso_8859_15_u, /* 93 ISO 8859-15 Latin 15 */
- iso_8859_15_u, /* 94 CP923 - Same as 8859-15 */
- iso_8859_7_u, /* 95 ELOT928 - Same as 8859-7 */
- quickdraw_u, /* 96 CP10000 - Apple Quickdraw */
- cp37_u, /* 97 CP37 - U.S. EBCDIC */
- cp1255_u, /* 98 CP1255 - Windows Hebrew */
- cp1256_u, /* 99 CP1256 - Windows Arabic */
- cp1258_u, /* 100 CP1258 - Windows Viet Nam */
- mazovia_u, /* 101 Mazovia PC code page */
- ident_u, /* 102 Transparent - no translation */
- hz1500_u, /* 103 Hazeltine 1500/1520 graphics */
- koi8r_u, /* 104 KOI8-R */
- koi8u_u /* 105 KOI8-U */
- };
- /*
- Table of Unicode-to-Blah translation functions.
- KEEP THIS IN SYNC WITH THE TX_blah DEFINITITIONS in ckcuni.h, and also
- with the tables above.
- */
- int
- #ifdef CK_ANSIC
- (*xl_tx[MAXTXSETS+1])(USHORT)
- #else
- (*xl_tx[MAXTXSETS+1])()
- #endif /* CK_ANSIC */
- = {
- tx_usascii, /* 0 US ISO 646 (ASCII) */
- tx_british, /* 1 UK ISO 646 */
- tx_fr_canadian, /* 2 Canadian French NRC */
- NULL, /* 3 Cuba */
- NULL, /* 4 Czecho */
- tx_danish, /* 5 Danish/Norwegian ISO 646 */
- tx_dutch, /* 6 Dutch NRC */
- tx_finnish, /* 7 Finnish NRC */
- tx_french, /* 8 French ISO 646 */
- tx_german, /* 9 German ISO 646 */
- tx_hebrew7, /* 10 Hebrew-7 (DEC) */
- tx_hungarian, /* 11 Hungarian ISO 646 */
- tx_icelandic, /* 12 Icelandic */
- tx_italian, /* 13 Italian ISO 646 */
- tx_jis0201r, /* 14 Japanese Roman ISO 646 */
- tx_jis0201k, /* 15 Japanese Katakana */
- tx_koi7, /* 16 Short KOI */
- tx_danish, /* 17 Norwegian/Danish ISO 646 */
- tx_portuguese, /* 18 Portuguese ISO 646 */
- tx_spanish, /* 19 spanish ISO 646 */
- tx_swedish, /* 20 Swedish ISO 646 */
- NULL, /* 21 Swedish ISO 646 for names */
- tx_swiss, /* 22 Swiss NRC */
- tx_ident, /* 23 ISO 8859-1 */
- tx_8859_2, /* 24 ISO 8859-2 */
- tx_8859_3, /* 25 ISO 8859-3 */
- tx_8859_4, /* 26 ISO 8859-4 */
- tx_8859_5, /* 27 ISO 8859-5 */ /* Cyrillic */
- tx_8859_6, /* 28 ISO 8859-6 */ /* Arabic */
- tx_8859_7, /* 29 ISO 8859-7 */ /* Greek */
- tx_8859_8, /* 30 ISO 8859-8 */ /* Hebrew */
- tx_8859_9, /* 31 ISO 8859-9 */ /* Latin-5 */
- tx_8859_10, /* 32 ISO 8859-10 */ /* Latin-6 */
- tx_koi8, /* 33 KOI-8 */
- NULL, /* 34 JIS-7 */
- NULL, /* 35 Shift JIS */
- NULL, /* 36 Japanese EUC (JAE) */
- NULL, /* 37 Japanese DEC Kanji */
- tx_decmcs, /* 38 DEC MCS */
- tx_nextstep, /* 39 NeXT */
- tx_dgi, /* 40 DGI */
- tx_maclatin, /* 41 Macintosh Latin */
- tx_hproman8, /* 42 HP Roman 8 */
- tx_cp437, /* 43 CP437 - Original */
- tx_cp850, /* 44 CP850 - W Europe */
- tx_cp852, /* 45 CP852 - E Europe */
- tx_cp857, /* 46 CP857 - Turkish */
- tx_cp862, /* 47 CP862 - Hebrew */
- tx_cp866, /* 48 CP864 - Arabic */
- tx_cp866, /* 49 CP866 - Cyrillic */
- tx_cp869, /* 50 CP869 - Greek */
- NULL, /* Display only */ /* 51 DEC Special Graphics */
- NULL, /* Display only */ /* 52 DEC Technical */
- NULL, /* Display only */ /* 53 C0 Pictures */
- NULL, /* Display only */ /* 54 C1 Pictures */
- NULL, /* Display only */ /* 55 IBM C0 Graphics */
- NULL, /* Display only */ /* 56 Heath 19 graphics */
- NULL, /* Display only */ /* 57 TVI graphics */
- NULL, /* Display only */ /* 58 Wyse 60 normal-mode graphics */
- NULL, /* Display only */ /* 59 Wyse 60 graphics 1 */
- NULL, /* Display only */ /* 60 Wyse 60 graphics 2 */
- NULL, /* Display only */ /* 61 Wyse 60 graphics 3 */
- tx_elot927, /* 62 Greek ELOT 927 */
- NULL, /* Display only */ /* 63 DG special graphics */
- NULL, /* Display only */ /* 64 DG line-drawing */
- NULL, /* Display only */ /* 65 DG word-processing */
- NULL, /* Display only */ /* 66 HP line-drawing */
- NULL, /* Display only */ /* 67 HP math/techical */
- NULL, /* Display only */ /* 68 QNX Graphics */
- NULL, /* Display only */ /* 69 SNI Brackets */
- NULL, /* Display only */ /* 70 SNI Euro */
- NULL, /* Display only */ /* 71 SNI Facet */
- NULL, /* Display only */ /* 72 SNI IBM */
- NULL, /* Display only */ /* 73 SNI Blanks */
- tx_cp1252, /* 74 Windows Latin-1 */
- tx_cp1250, /* 75 Windows Latin-2 */
- tx_cp1251, /* 76 Windows Cyrillic */
- tx_cp1253, /* 77 Windows Greek */
- tx_cp1254, /* 78 Windows Turkish */
- tx_cp1257, /* 79 Windows Latin-4 */
- tx_cp856, /* 80 Cyrillic PC Code Page 856 */
- tx_cp855, /* 81 Cyrillic PC Code Page 855 */
- tx_ident, /* 82 CP819 - Same as 8859-1 */
- tx_8859_2, /* 83 CP912 - Same as 8859-2 */
- tx_8859_3, /* 84 CP913 - Same as 8859-3 */
- tx_8859_4, /* 85 CP914 - Same as 8859-4 */
- tx_8859_5, /* 86 CP915 - Same as 8859-5 */
- tx_8859_6, /* 87 CP1089 - Same as 8859-6 */
- tx_8859_7, /* 88 CP813 - Same as 8859-7 */
- tx_8859_8, /* 89 CP916 - Same as 8859-8 */
- tx_8859_9, /* 90 CP920 - Same as 8859-9 */
- tx_hproman8, /* 91 CP1051 -Same as HP Roman 8 */
- tx_cp858, /* 92 CP858 - W Europe w/Euro */
- tx_8859_15, /* 93 ISO 8859-15 Latin 15 */
- tx_8859_15, /* 94 CP923 - Same as Latin 15 */
- tx_8859_7, /* 95 ELOT928 - Same as 8859-7 */
- tx_quickdraw, /* 96 CP10000 - Apple Quickdraw */
- tx_cp37, /* 97 CP37 - U.S. EBCDIC */
- tx_cp1255, /* 98 CP1255 - Windows Hebrew */
- tx_cp1256, /* 99 CP1256 - Windows Arabic */
- tx_cp1258, /* 100 CP1258 - Windows Viet Nam */
- tx_mazovia, /* 101 Mazovia PC code page */
- tx_ident, /* 102 Transparent - no translation */
- NULL, /* Display only */ /* 103 Hazeltine 1500/1520 graphics */
- tx_koi8r, /* 104 KOI8-R */
- tx_koi8u /* 105 KOI8-U */
- };
- /*
- Table of FCS-to-Unicode translation functions.
- KEEP THIS IN SYNC WITH THE FC_blah DEFINITITIONS in ckuxla.h.
- */
- USHORT
- #ifdef CK_ANSIC
- (*xl_fcu[MAXFCSETS+1])(CHAR)
- #else
- (*xl_fcu[MAXFCSETS+1])()
- #endif /* CK_ANSIC */
- = {
- ascii_u, /* 0 US ISO 646 (ASCII) */
- british_u, /* 1 UK ISO 646 */
- dutch_u, /* 2 Dutch NRC */
- finnish_u, /* 3 Finnish NRC */
- french_u, /* 4 French ISO 646 */
- fr_canadian_u, /* 5 Canadian French NRC */
- german_u, /* 6 German ISO 646 */
- hungarian_u, /* 7 Hungarian ISO 646 */
- italian_u, /* 8 Italian ISO 646 */
- danish_u, /* 9 Danish/Norwegian ISO 646 */
- portuguese_u, /* 10 Portuguese ISO 646 */
- spanish_u, /* 11 spanish ISO 646 */
- swedish_u, /* 12 Swedish ISO 646 */
- swiss_u, /* 13 Swiss NRC */
- iso_8859_1_u, /* 14 ISO 8859-1 Latin-1 */
- iso_8859_2_u, /* 15 ISO 8859-2 Latin-2 */
- decmcs_u, /* 16 DEC MCS */
- nextstep_u, /* 17 NeXT */
- cp437_u, /* 18 CP437 - Original */
- cp850_u, /* 19 CP850 - W Europe */
- cp852_u, /* 20 CP852 - E Europe */
- quickdraw_u, /* 21 CP10000 - Apple Quickdraw */
- dgi_u, /* 22 DGI */
- hproman8_u, /* 23 HP Roman 8 */
- iso_8859_5_u, /* 24 ISO 8859-5 Cyrillic */
- cp866_u, /* 25 CP866 - Cyrillic */
- koi7_u, /* 26 Short KOI */
- koi8_u, /* 27 KOI-8 */
- NULL, /* 28 JIS-7 */
- NULL, /* 29 Shift-JIS */
- NULL, /* 30 Japanese EUC */
- NULL, /* 31 DEC Kanji */
- hebrew7_u, /* 32 Hebrew-7 (DEC) */
- iso_8859_8_u, /* 33 ISO 8859-8 Hebrew */
- cp862_u, /* 34 CP862 Hebrew */
- elot927_u, /* 35 Greek ELOT 927 */
- iso_8859_7_u, /* 36 ISO 8859-7 Greek */
- cp869_u, /* 37 CP869 Greek */
- iso_8859_15_u, /* 38 ISO 8859-15 Latin-9 */
- cp858_u, /* 39 CP858 - W Europe w/Euro */
- cp855_u, /* 40 Cyrillic PC Code Page 856 */
- cp1251_u, /* 41 Windows Cyrillic */
- cp856_u, /* 42 Bulgarian PC Code Page 856 */
- cp1250_u, /* 43 Windows Latin-2 */
- mazovia_u, /* 44 Mazovia PC code page */
- NULL, /* 45 UCS-2 */
- NULL, /* 46 UTF-8 */
- koi8r_u, /* 47 KOI8-R */
- koi8u_u /* 48 KOI8-U */
- };
- /*
- Table of Unicode-to-FCS translation functions.
- KEEP THIS IN SYNC WITH THE FC_blah DEFINITITIONS in ckuxla.h.
- */
- int
- #ifdef CK_ANSIC
- (*xl_ufc[MAXFCSETS+1])(USHORT)
- #else
- (*xl_ufc[MAXFCSETS+1])()
- #endif /* CK_ANSIC */
- = {
- tx_usascii, /* 0 US ISO 646 (ASCII) */
- tx_british, /* 1 UK ISO 646 */
- tx_dutch, /* 2 Dutch NRC */
- tx_finnish, /* 3 Finnish NRC */
- tx_french, /* 4 French ISO 646 */
- tx_fr_canadian, /* 5 Canadian French NRC */
- tx_german, /* 6 German ISO 646 */
- tx_hungarian, /* 7 Hungarian ISO 646 */
- tx_italian, /* 8 Italian ISO 646 */
- tx_danish, /* 9 Danish/Norwegian ISO 646 */
- tx_portuguese, /* 10 Portuguese ISO 646 */
- tx_spanish, /* 11 spanish ISO 646 */
- tx_swedish, /* 12 Swedish ISO 646 */
- tx_swiss, /* 13 Swiss NRC */
- tx_ident, /* 14 ISO 8859-1 Latin-1 */
- tx_8859_2, /* 15 ISO 8859-2 Latin-2 */
- tx_decmcs, /* 16 DEC MCS */
- tx_nextstep, /* 17 NeXT */
- tx_cp437, /* 18 CP437 - Original */
- tx_cp850, /* 19 CP850 - W Europe */
- tx_cp852, /* 20 CP852 - E Europe */
- tx_quickdraw, /* 21 CP10000 - Apple Quickdraw */
- tx_dgi, /* 22 DGI */
- tx_hproman8, /* 23 HP Roman 8 */
- tx_8859_5, /* 24 ISO 8859-5 Cyrillic */
- tx_cp866, /* 25 CP866 - Cyrillic */
- tx_koi7, /* 26 Short KOI */
- tx_koi8, /* 27 KOI-8 */
- NULL, /* 28 JIS-7 */
- NULL, /* 29 Shift-JIS */
- NULL, /* 30 Japanese EUC */
- NULL, /* 31 DEC Kanji */
- tx_hebrew7, /* 32 Hebrew-7 (DEC) */
- tx_8859_8, /* 33 ISO 8859-8 Hebrew */
- tx_cp862, /* 34 CP862 Hebrew */
- tx_elot927, /* 35 Greek ELOT 927 */
- tx_8859_7, /* 36 ISO 8859-7 Greek */
- tx_cp869, /* 37 CP869 Greek */
- tx_8859_15, /* 38 ISO 8859-15 Latin-9 */
- tx_cp858, /* 39 CP858 - W Europe w/Euro */
- tx_cp855, /* 40 Cyrillic PC Code Page 856 */
- tx_cp1251, /* 41 Windows Cyrillic */
- tx_cp856, /* 42 Bulgarian PC Code Page 856 */
- tx_cp1250, /* 43 Windows Latin-2 */
- tx_mazovia, /* 44 Mazovia PC code page */
- NULL, /* 45 UCS-2 */
- NULL, /* 46 UTF-8 */
- tx_koi8r, /* 47 KOI8-R */
- tx_koi8u /* 48 KOI8-U */
- };
- /*
- Table of TCS-to-Unicode translation functions.
- KEEP THIS IN SYNC WITH THE TC_blah DEFINITIONS in ckuxla.h.
- */
- USHORT
- #ifdef CK_ANSIC
- (*xl_tcu[MAXTCSETS+1])(CHAR)
- #else
- (*xl_tcu[MAXTCSETS+1])()
- #endif /* CK_ANSIC */
- = {
- NULL, /* 0 = Transparent */
- ascii_u, /* 1 = ASCII */
- iso_8859_1_u, /* 2 ISO 8859-1 Latin-1 */
- iso_8859_2_u, /* 3 ISO 8859-2 Latin-2 */
- iso_8859_5_u, /* 4 ISO 8859-5 Cyrillic */
- NULL, /* 5 Japanese EUC */
- iso_8859_8_u, /* 6 ISO 8859-8 Hebrew */
- iso_8859_7_u, /* 7 ISO 8859-7 Greek */
- iso_8859_15_u, /* 8 ISO 8859-15 Latin-9 */
- NULL, /* 9 UCS-2 */
- NULL /* 10 UTF-8 */
- };
- /*
- Table of Unicode-to-TCS translation functions.
- KEEP THIS IN SYNC WITH THE TC_blah DEFINITIONS in ckuxla.h.
- */
- int
- #ifdef CK_ANSIC
- (*xl_utc[MAXTCSETS+1])(USHORT)
- #else
- (*xl_utc[MAXTCSETS+1])()
- #endif /* CK_ANSIC */
- = {
- NULL, /* 0 = Transparent */
- tx_usascii, /* 1 = ASCII */
- tx_ident, /* 2 ISO 8859-1 Latin-1 */
- tx_8859_2, /* 3 ISO 8859-2 Latin-2 */
- tx_8859_5, /* 4 ISO 8859-5 Cyrillic */
- NULL, /* 5 Japanese EUC */
- tx_8859_8, /* 6 ISO 8859-8 Hebrew */
- tx_8859_7, /* 7 ISO 8859-7 Greek */
- tx_8859_15, /* 8 ISO 8859-15 Latin-9 */
- NULL, /* 9 UCS-2 */
- NULL /* 10 UTF-8 */
- };
- #ifdef COMMENT
- /*
- The UTF8 conversions are based on the ConvertUTF functions written
- by Mark E. Davis, copyright 1994 Taligent, Inc.
- Tables for use in calculating UTF8 conversions. These contain
- support for ISO-10646 which supports a 31-bit char size.
- NOTE: 0xnnnUL is NOT portable!
- */
- ULONG
- offsetsFromUTF8[7] = {
- #ifdef CK_ANSIC
- 0x00000000UL, /* Ignored */
- 0x00000000UL, 0x00003080UL, 0x000E2080UL,
- 0x03C82080UL, 0xFA082080UL, 0x82082080UL
- #else
- 0x00000000L, /* Ignored */
- 0x00000000L, 0x00003080L, 0x000E2080L,
- 0x03C82080L, (unsigned) 0xFA082080L, (unsigned) 0x82082080L
- #endif /* CK_ANSIC */
- };
- CHAR bytesInUTF8[256] = {
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 4,4,4,4,4,4,4,4,5,5,5,5,6,6,6,6
- };
- #endif /* COMMENT */
- CHAR firstByteMark[7] = {0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC};
- /*
- utf8_to_ucs2() takes one UTF-8 byte at a time. It returns a pointer the
- UCS-2 character if and only if the entire UTF-8 string has been received.
- Return values:
- 0: Complete UTF-8 sequence received; ucs2 points to valid ucs2 character.
- >0: UTF-8 sequence incomplete, ignore ucs2 value.
- <0: UTF-8 error, 0xfffd should be inserted BEFORE the ucs2 value.
- NOTE: A negative value is returned only when two return values are indicated,
- e.g. when a UTF-8 sequence is interrupted by an ASCII char. In this case
- the incomplete UTF-8 sequence must be replaced by 0xfffd, and then the ASCII
- character is kept as-is. In other error cases, ucs2 is set to 0xfffd and
- the return value is 0.
- */
- #define UTFBUFSIZ 16
- int
- #ifdef CK_ANSIC
- utf8_to_ucs2(CHAR ch, USHORT ** ucs2)
- #else
- utf8_to_ucs2(ch, ucs2) CHAR ch; USHORT ** ucs2;
- #endif /* CK_ANSIC */
- {
- static USHORT ucs2return = 0;
- #ifdef COMMENT
- /* Unicode Consortium sample code works only with well-formed UTF8 */
- int i = 0;
- static int len = 0;
- static CHAR utf8[UTFBUFSIZ] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
- ULONG ucs4 = 0;
- utf8[len++] = ch; /* Add char to string to process */
- if (len < bytesInUTF8[utf8[0]]) /* Need more bytes */
- return(bytesInUTF8[utf8[0]] - len);
- switch (len) { /* Have complete sequence... */
- case 6: ucs4 += utf8[i++]; ucs4 <<= 6; /* (fall-thru is intentional) */
- case 5: ucs4 += utf8[i++]; ucs4 <<= 6;
- case 4: ucs4 += utf8[i++]; ucs4 <<= 6;
- case 3: ucs4 += utf8[i++]; ucs4 <<= 6;
- case 2: ucs4 += utf8[i++]; ucs4 <<= 6;
- case 1: ucs4 += utf8[i++];
- }
- ucs4 -= offsetsFromUTF8[len];
- ucs2return = (USHORT)(ucs4 & 0xFFFF);
- #ifdef DEBUG
- /* This shows that our return value is in the prevailing byte order: */
- /* e.g. LE on PC, BE on Sparc. */
- if (deblog) {
- char buf[16];
- union ck_short xx;
- xx.x_short = ucs2return;
- sprintf(buf,"%04X",ucs2return);
- debug(F111,"utf8_to_ucs2 short",buf,ucs2return);
- debug(F101,"utf8_to_ucs2 char[0]","",xx.x_char[0]);
- debug(F101,"utf8_to_ucs2 char[1]","",xx.x_char[1]);
- }
- #endif /* DEBUG */
- *ucs2 = &ucs2return;
- len = 0;
- return(0);
- #else
- /*
- Robuster code adapted from Thomas Dickey, Xfree86,
- recommended by Markus Kuhn.
- */
- static int utfcount = 0; /* Position in UTF sequence */
- int utferror = 0; /* Flag for malformed UTF */
- unsigned c = ch; /* Input byte */
- int haveucs2 = 0;
- if (ch < 0x80) { /* ASCII char... */
- if (utfcount > 0) /* Not legal in UTF-8 sequence */
- utferror = 1; /* so flag */
- haveucs2 = 1;
- ucs2return = ch; /* but also return it */
- utfcount = 0; /* reset UTF-8 count */
- } else if (ch < 0xc0) { /* 0x80 <= c < 0xc0... */
- if (utfcount < 1) { /* Not valid in first position... */
- utferror = 1;
- } else { /* Maybe valid */
- if (ucs2return > 0x03ff) { /* Value would be > 0xffff */
- utferror = 1; /* so not valid */
- } else { /* OK... */
- ucs2return <<= 6; /* Shift result */
- ucs2return |= (ch & 0x3f); /* and OR in this byte */
- }
- if (--utfcount == 0)
- haveucs2 = 1;
- }
- } else { /* c >= 0xc0... */
- if (utfcount > 0)
- utferror = 1;
- if (c < 0xe0) {
- utfcount = 1;
- ucs2return = (c & 0x1f);
- haveucs2 = 1;
- } else if (c < 0xf0) {
- utfcount = 2;
- ucs2return = (c & 0x0f);
- haveucs2 = 1;
- } else if (c < 0xf8) {
- utfcount = 3;
- ucs2return = (c & 0x07);
- haveucs2 = 1;
- } else if (c < 0xfc) {
- utfcount = 4;
- ucs2return = (c & 0x03);
- haveucs2 = 1;
- } else if (c < 0xfe) {
- utfcount = 5;
- ucs2return = (c & 0x01);
- haveucs2 = 1;
- } else {
- utferror = 1;
- utfcount = 0;
- }
- }
- if (haveucs2 == 0 && utferror != 0) {
- haveucs2 = 1;
- ucs2return = 0xfffd;
- utferror = 0;
- }
- if (haveucs2) {
- *ucs2 = &ucs2return;
- if (utferror)
- utfcount = 0 - utfcount;
- return(utfcount);
- } else {
- if (utfcount == 0)
- utfcount++;
- return(utfcount);
- }
- #endif /* COMMENT */
- }
- /*
- ucs2_to_utf8() takes one ucs2 character and returns the length and
- and a pointer to an array containing the equivalent utf8 string.
- This code can easily be altered to support UCS4 simply by changing
- the input from USHORT to ULONG. Returns:
- >0: Number of bytes in the utf8 string.
- 0: (or less) Error.
- */
- int
- #ifdef CK_ANSIC
- ucs2_to_utf8(USHORT ucs2, CHAR ** utf8)
- #else
- ucs2_to_utf8(ucs2, utf8) USHORT ucs2; CHAR ** utf8;
- #endif /* CK_ANSIC */
- {
- static CHAR utf8return[8]={0,0,0,0,0,0,0,0};
- register CONST ULONG byteMask = 0xBF;
- register CONST ULONG byteMark = 0x80;
- int utf8len = 0;
- int i = 0;
- if (ucs2 < 0x80) {
- utf8len = 1;
- debug(F101,"ucs2_to_utf8 X1","",utf8len);
- } else if (ucs2 < 0x800) {
- utf8len = 2;
- debug(F101,"ucs2_to_utf8 X2","",utf8len);
- } else
- #ifdef DO_UCS4
- /* This is always true for UCS-2 but would be needed for UCS-4*/
- /* When ucs2 is USHORT this gives compiler warnings. */
- if (ucs2 <= 0xffff)
- #endif /* DO_UCS4 */
- {
- utf8len = 3;
- debug(F101,"ucs2_to_utf8 X3","",utf8len);
- }
- #ifdef DO_UCS4
- /* The following would be for UCS-4 */
- else if (ucs2 < 0x200000) {
- utf8len = 4;
- } else if (ucs2 < 0x4000000) {
- utf8len = 5;
- } else if (ucs2 <=
- #ifdef CK_ANSIC
- 0x7FFFFFFFUL /* (doesn't really need the "U") */
- #else
- 0x7FFFFFFFL
- #endif /* CK_ANSIC */
- ) { /* 31 bits = max for UCS4 */
- utf8len = 6;
- } else {
- utf8len = 2;
- ucs2 = 0xFFFD; /* Replacement for invalid char */
- }
- #endif /* DO_UCS4 */
- i = utf8len; /* index into utf8return */
- utf8return[i--] = 0; /* Null terminate the string */
- switch (utf8len) { /* code falls through cases! */
- case 6: utf8return[i--] = (ucs2 | byteMark) & byteMask; ucs2 >>= 6;
- case 5: utf8return[i--] = (ucs2 | byteMark) & byteMask; ucs2 >>= 6;
- case 4: utf8return[i--] = (ucs2 | byteMark) & byteMask; ucs2 >>= 6;
- case 3: utf8return[i--] = (ucs2 | byteMark) & byteMask; ucs2 >>= 6;
- case 2: utf8return[i--] = (ucs2 | byteMark) & byteMask; ucs2 >>= 6;
- case 1: utf8return[i--] = ucs2 | firstByteMark[utf8len];
- }
- debug(F111,"ucs2_to_utf8",utf8return,utf8len);
- *utf8 = utf8return;
- return(utf8len);
- }
- /* UTF-8 functions... */
- #ifdef CK_ANSIC
- extern int (*xuf)(USHORT); /* Translation function UCS to FCS */
- extern USHORT (*xfu)(CHAR); /* Translation function FCS to UCS */
- #else
- extern int (*xuf)();
- extern USHORT (*xfu)();
- #endif /* CK_ANSIC */
- /* u _ t o _ b -- UTF-8 to Byte */
- /*
- Converts from UTF-8 to the current terminal or file character set.
- Call with:
- c: a single byte, which is part of a UTF-8 stream.
- Returns:
- -9: Error, with second char to follow (call u_to_b2() to get it).
- -2: UCS line/paragraph end (LS or PS).
- -1: UTF-8 stream is incomplete and more input is required.
- >=0: Byte value of result, possibly the "error" byte (e.g. '?').
- Requires:
- Global (*xuf)() to point to a function that translates from UCS-2 to
- the appropriate term/file character set.
- */
- static int savedbyte = 0;
- int /* Call if u_to_b() returns -9 */
- u_to_b2() {
- return((unsigned)(savedbyte & 0xff));
- }
- int /* UTF-8 to byte */
- #ifdef CK_ANSIC
- u_to_b(CHAR c)
- #else
- u_to_b(c) CHAR c;
- #endif /* CK_ANSIC */
- {
- int x;
- USHORT * ucs2, uc;
- if (!xuf) /* If no conversion function */
- return(c); /* don't convert (shouldn't happen). */
- x = utf8_to_ucs2(c,&ucs2); /* Send for conversion to UCS-2 */
- if (x > 0) /* Not done yet... */
- return(-1);
- uc = (x < 0) ? 0xfffd : *ucs2; /* Done, check result */
- if (uc == 0x2028 || uc == 0x2029) /* LS or PS */
- return(-2);
- return((unsigned)(((*xuf)(uc)) & 0xff)); /* Convert UCS-2 to byte */
- }
- /* b _ t o _ u -- Byte to UTF-8 */
- /*
- Converts a byte from the current terminal or file character set to UTF-8.
- Call with:
- c........ The byte to be converted.
- buf...... Pointer to buffer in which to place the result.
- buflen... Length of the result buffer.
- setsize.. The size of the source character set (128 or 256).
- Requires:
- Global (*xfu)() to point to the function to convert the byte to UCS-2.
- Returns:
- -1 if the xfu is NULL; otherwise:
- >0 indicating the length (in bytes) of the UTF-8 string.
- If the translation fails, the Unicode "Replacement Character" is returned
- (0xFFFD translated to UTF-8 == 0xFFBD).
- */
- int /* Byte to UTF-8 */
- #ifdef CK_ANSIC
- b_to_u(CHAR c, CHAR * buf, int buflen, int setsize)
- #else
- b_to_u(c, buf, buflen, setsize) CHAR c, * buf; int buflen, setsize;
- #endif /* CK_ANSIC */
- {
- CHAR * tmp = NULL;
- int i, count = 0;
- USHORT uc;
- if (!xfu) {
- debug(F100,"b_to_u no xfu","",0);
- return(-1);
- }
- uc = c;
- if (((setsize > 128) && (c & 0x80)) || setsize <= 128) {
- if (xfu) /* FCS-to-UCS function */
- uc = (*xfu)(c);
- }
- count = ucs2_to_utf8(uc,&tmp);
- if (count < 0) {
- buf[0] = 0xff; /* == 0xFFFD in UTF-8 */
- buf[1] = 0xbd;
- buf[3] = ' ';
- return(2);
- }
- if (count >= buflen) {
- debug(F101,"WARNING: UTF8 buffer overflow","",count);
- count = buflen - 1;
- }
- for (i = 0; i < count; i++) /* Copy to result buffer */
- buf[i] = tmp[i];
- buf[i] = ' ';
- return(count);
- }
- #ifndef OS2
- int
- isunicode( /* Tells whether the host we are */
- #ifdef CK_ANSIC /* running on supports Unicode */
- void /* display */
- #endif /* CK_ANSIC */
- ) {
- extern int tt_unicode;
- #ifdef NT
- #ifdef KUI
- return(tt_unicode);
- #else /* KUI */
- if (tt_unicode && !isWin95())
- return(1);
- else
- return(0);
- #endif /* KUI */
- #else /* NT */
- return(0);
- #endif /* NT */
- }
- #endif /* OS2 */
- #endif /* UNICODE */