📄 ckuxla.c
字号:
#ifndef NOCSETSchar *xlav = "Character Set Translation 5A(018), 21 Nov 92";/* C K U X L A *//* C-Kermit tables and functions supporting character set translation. *//* Author: Frank da Cruz (fdc@columbia.edu, FDCCU@CUVMA.BITNET), Columbia University Center for Computing Activities. Copyright (C) 1985, 1992, Trustees of Columbia University in the City of New York. Permission is granted to any individual or institution to use this software as long as it is not sold for profit. This copyright notice must be retained. This software may not be included in commercial products without written permission of Columbia University.*//* CAVEAT PROGRAMMOR: The mechanism used here turns out to be somewhat inflexible and maybe a little dangerous. It is designed for Kermit's character-at-a-time processing during protocol operations. Elaborate kludges are used for translating one character into two (like stuffing an extra character into the input stream), or two into one, or two into two. The whole translation business needs to be redesigned to be string-oriented rather than character oriented, so (a) we can have more flexible translations, and (b) we don't have to be concerned about which input stream we are using. The current mechanism is also quite inappropriate for multibyte character sets and for flexible user-defined translations. For the future: perhaps it would be better to represent characters internally using a universal character set like UNICODE (ISO 10646 BMP), the ultimate "transfer character set".*/#include "ckcdeb.h" /* Includes... */#include "ckcker.h"#include "ckucmd.h"#include "ckcxla.h"/* Character set translation data and functions */extern int zincnt; /* File i/o macros and variables */extern char *zinptr;extern int zoutcnt;extern char *zoutptr;int tslevel = TS_L0; /* Transfer syntax level (0,1,2) */int tcharset = TC_TRANSP; /* Transfer syntax character set */int tcsr = FC_USASCII; /* Remote terminal character set */int language = L_USASCII; /* Language *//* Default local file and terminal character set. Normally ASCII, but for some systems we know otherwise.*/#ifdef datageneral /* Data General AOS/VS */int fcharset = FC_DGMCS; /* uses the DG International set */int tcsl = FC_DGMCS;#else#ifdef NEXT /* The NeXT workstation */int fcharset = FC_NEXT; /* uses its own 8-bit set */int tcsl = FC_NEXT;#else#ifdef MAC /* The Macintosh */int fcharset = FC_APPQD; /* uses an extended version of */int tcsl = FC_APPQD; /* Apple Quickdraw */#else#ifdef AUXint fcharset = FC_APPQD; /* Ditto for Apple A/UX */int tcsl = FC_APPQD;#else#ifdef AMIGA /* The Commodore Amiga */int fcharset = FC_1LATIN; /* uses Latin-1 */int tcsl = FC_1LATIN;#else /* All others */int fcharset = FC_USASCII; /* use ASCII by default */int tcsl = FC_USASCII;#endif /* AMIGA */#endif /* AUX */#endif /* MAC */#endif /* NEXT */#endif /* datageneral */_PROTOTYP( CHAR xnel1, (CHAR c) ); /* NeXT to Latin-1 */_PROTOTYP( CHAR xl143, (CHAR c) ); /* Latin-1 to IBM CP437 */_PROTOTYP( CHAR xl1as, (CHAR c) ); /* Latin-1 to US ASCII */_PROTOTYP( CHAR zl1as, (CHAR c) ); /* Latin-1 to US ASCII */#ifdef CYRILLIC_PROTOTYP( CHAR xassk, (CHAR c) ); /* ASCII to Short KOI */_PROTOTYP( CHAR xskcy, (CHAR c) ); /* Short KOI to Latin/Cyrillic */#endif /* CYRILLIC */#ifdef LATIN2_PROTOTYP( CHAR xnel2, (CHAR c) ); /* NeXT to Latin-2 */_PROTOTYP( CHAR xl243, (CHAR c) ); /* Latin-2 to IBM CP437 */_PROTOTYP( CHAR xl2as, (CHAR c) ); /* Latin-2 to US ASCII */_PROTOTYP( CHAR zl2as, (CHAR c) ); /* Latin-2 to US ASCII */#endif /* LATIN2 *//* Transfer character-set info */struct csinfo tcsinfo[] = {/* Name size code designator alphabet */ "TRANSPARENT, no translation", 256, TC_TRANSP, "", AL_UNK, /* 0 */ "ASCII", 128, TC_USASCII, "", AL_ROMAN, /* 1 */ "LATIN1, ISO 8859-1", 256, TC_1LATIN, "I6/100", AL_ROMAN, /* 2 */#ifdef LATIN2 "LATIN2, ISO 8859-2", 256, TC_2LATIN, "I6/101", AL_ROMAN, /* 3 */#else "LATIN2 not supported", 0, TC_TRANSP, "XXX", AL_UNK, /* 3 */#endif /* LATIN2 */#ifdef CYRILLIC "CYRILLIC, ISO 8859-5", 256, TC_CYRILL, "I6/144",AL_CYRIL, /* 4 */#else "CYRILLIC not supported", 0, TC_TRANSP, "XXX", AL_UNK, /* 4 */#endif /* CYRILLIC *//* NOTE: the second entry is obsolete, but retained temporarily. The proper designator is given in the first entry. C-Kermit sends the first (proper) form, but accepts either form.*/#ifdef KANJI "KANJI (EUC)", 16384, TC_JEUC, "I14/87/13", AL_JAPAN, /* 5 */ "KANJI (EUC)", 16384, TC_JEUC, "I14/87E", AL_JAPAN /* 5 */#else "KANJI not supported", 0, TC_TRANSP,"XXX", AL_UNK, /* 5 */#endif /* KANJI */};int ntcsets = (sizeof(tcsinfo) / sizeof(struct csinfo));struct keytab tcstab[] = { /* Keyword table for */ "ascii", TC_USASCII, 0, /* SET TRANSFER CHARACTER-SET */#ifdef CYRILLIC "cyrillic-iso", TC_CYRILL, 0,#endif /* CYRILLIC */#ifdef KANJI "japanese-euc", TC_JEUC, 0,#endif /* KANJI */#ifdef LATIN2/* If Latin-2 is defined, let the following be invisible, non-unique abbreviations for LATIN1.*/ "l", TC_1LATIN, CM_ABR|CM_INV, "la", TC_1LATIN, CM_ABR|CM_INV, "lat", TC_1LATIN, CM_ABR|CM_INV, "lati", TC_1LATIN, CM_ABR|CM_INV, "latin", TC_1LATIN, CM_ABR|CM_INV,#endif /* LATIN2 */ "latin1-iso", TC_1LATIN, 0,#ifdef LATIN2 "latin2-iso", TC_2LATIN, 0,#endif /* LATIN2 */ "transparent", TC_TRANSP, 0};int ntcs = (sizeof(tcstab) / sizeof(struct keytab));/* File character set information structure, indexed by character set code, *//* as defined in ckuxla.h. This table must be in order of file character *//* set number! */ struct csinfo fcsinfo[] = { /* File character set information... */ /* Descriptive Name Size Designator */ "US ASCII", 128, FC_USASCII, NULL, AL_ROMAN, "British/UK ISO-646", 128, FC_UKASCII, NULL, AL_ROMAN, "Dutch ISO-646", 128, FC_DUASCII, NULL, AL_ROMAN, "Finnish ISO-646", 128, FC_FIASCII, NULL, AL_ROMAN, "French ISO-646", 128, FC_FRASCII, NULL, AL_ROMAN, "Canadian-French ISO-646", 128, FC_FCASCII, NULL, AL_ROMAN, "German ISO-646", 128, FC_GEASCII, NULL, AL_ROMAN, "Hungarian ISO-646", 128, FC_HUASCII, NULL, AL_ROMAN, "Italian ISO-646", 128, FC_ITASCII, NULL, AL_ROMAN, "Norwegian/Danish ISO-646", 128, FC_NOASCII, NULL, AL_ROMAN, "Portuguese ISO-646", 128, FC_POASCII, NULL, AL_ROMAN, "Spanish ISO-646", 128, FC_SPASCII, NULL, AL_ROMAN, "Swedish ISO-646", 128, FC_SWASCII, NULL, AL_ROMAN, "Swiss ISO-646", 128, FC_CHASCII, NULL, AL_ROMAN, "ISO 8859-1 Latin-1", 256, FC_1LATIN, NULL, AL_ROMAN,#ifdef LATIN2 "ISO 8859-2 Latin-2", 256, FC_2LATIN, NULL, AL_ROMAN,#endif /* LATIN2 */ "DEC Multinational", 256, FC_DECMCS, NULL, AL_ROMAN, "NeXT Multinational", 256, FC_NEXT, NULL, AL_ROMAN, "IBM Code Page 437", 256, FC_CP437, NULL, AL_ROMAN, "IBM Code Page 850", 256, FC_CP850, NULL, AL_ROMAN,#ifdef LATIN2 "IBM Code Page 852", 256, FC_CP852, NULL, AL_ROMAN,#endif /* LATIN2 */ "Apple Macintosh Latin", 256, FC_APPQD, NULL, AL_ROMAN, "Data General International", 256, FC_DGMCS, NULL, AL_ROMAN#ifdef CYRILLIC, "ISO 8859-5 Latin/Cyrillic", 256, FC_CYRILL, NULL, AL_CYRIL, "CP866 Cyrillic", 256, FC_CP866, NULL, AL_CYRIL, "Short KOI", 128, FC_KOI7, NULL, AL_CYRIL, "Old KOI-8 Cyrillic", 256, FC_KOI8, NULL, AL_CYRIL#endif /* CYRILLIC */#ifdef KANJI, "Japanese JIS7", 256, FC_JIS7, NULL, AL_JAPAN, "Japanese Shift JIS", 16384, FC_SHJIS, NULL, AL_JAPAN, "Japanese EUC", 16384, FC_JEUC, NULL, AL_JAPAN, "Japanese DEC Kanji", 16384, FC_JDEC, NULL, AL_JAPAN#endif /* KANJI */}; /* Local file character sets *//* Includes 7-bit National Replacement Character Sets of ISO 646 *//* Plus ISO Latin-1, DEC Multinational Character Set (MCS), NeXT char set */struct keytab fcstab[] = { /* Keyword table for 'set file character-set' *//* IMPORTANT: This table is replicated below as ttcstab (terminal character set table). The only differences are the addition of TRANSPARENT and the removal of the Kanji sets, which are not supported yet. If you make changes to this table, also change ttcstab.*//* Keyword Value Flags */ "apple-quickdraw", FC_APPQD, CM_INV, /* Apple Quickdraw */ "ascii", FC_USASCII, 0, /* ASCII */ "british", FC_UKASCII, 0, /* British NRC */ "canadian-french", FC_FCASCII, 0, /* French Canadian NRC */ "cp437", FC_CP437, 0, /* IBM CP437 */ "cp850", FC_CP850, 0, /* IBM CP850 */#ifdef LATIN2 "cp852", FC_CP852, 0, /* IBM CP852 */#endif /* LATIN2 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -