📄 ckuxla.c
字号:
#include "ckcsym.h"#include "ckcdeb.h" /* Includes... */#include "ckcker.h"#include "ckucmd.h"#include "ckcxla.h"#ifdef OS2 /* includes the definition of CKOUNI */#include "ckouni.h"#endif /* OS2 */#ifndef NOCSETSchar *xlav = "Character Set Translation 6.0.024, 4 Jul 96";/* 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 Academic Information Systems, New York City. Copyright (C) 1985, 1996, Trustees of Columbia University in the City of New York. The C-Kermit software may not be, in whole or in part, licensed or sold for profit as a software product itself, nor may it be included in or distributed with commercial products or otherwise distributed by commercial concerns to their clients or customers without written permission of the Office of Kermit Development and Distribution, Columbia University. This copyright notice must not be removed, altered, or obscured.*//* CAVEAT PROGRAMMATOR: The mechanism used herein 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 might 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" (or not)...*//* Character set translation data and functions */extern int zincnt; /* File i/o macros and variables */extern char *zinptr;extern int zoutcnt;extern char *zoutptr;#ifdef _UCC /* For OS-9 */#define CONST const#else#define CONST#endif /* _UCC */int tslevel = TS_L0; /* Transfer syntax level (0,1,2) */int tcharset = TC_TRANSP; /* Transfer syntax character set */#ifdef CKOUNIint tcsr = TX_8859_1; /* Remote terminal character set */#else /* CKOUNI */int tcsr = FC_USASCII;#endif /* CKOUNI */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 */#ifdef CKOUNI /* OS/2 Unicode */int fcharset = FC_1LATIN;int tcsl = TX_8859_1;#else /* All others */int fcharset = FC_USASCII; /* use ASCII by default */int tcsl = FC_USASCII;#endif /* CKOUNI */#endif /* AMIGA */#endif /* AUX */#endif /* MAC */#endif /* NEXT */#endif /* datageneral *//* Bureaucracy section */_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 */_PROTOTYP( CHAR xl2r8, (CHAR c) ); /* Latin-2 to HP */#endif /* LATIN2 *//* Transfer character-set info */struct csinfo tcsinfo[] = {/* Name size code designator alphabet keyword */ "TRANSPARENT", 256,TC_TRANSP, "", AL_UNK, "transparent", /* 0 */ "ASCII", 128,TC_USASCII,"", AL_ROMAN,"ascii", /* 1 */ "LATIN1, ISO 8859-1",256,TC_1LATIN, "I6/100",AL_ROMAN,"latin1-iso", /* 2 */#ifdef LATIN2 "LATIN2, ISO 8859-2",256,TC_2LATIN, "I6/101",AL_ROMAN,"latin2-iso", /* 3 */#endif /* LATIN2 */#ifdef CYRILLIC "CYRILLIC, ISO 8859-5",256,TC_CYRILL,"I6/144",AL_CYRIL,"cyrillic-iso",/* 4 */#endif /* CYRILLIC */#ifdef KANJI "KANJI (EUC)", 16384,TC_JEUC, "I14/87/13", AL_JAPAN, "japanese-euc", /* 5 */#endif /* KANJI */#ifdef HEBREW "HEBREW, ISO 8859-8",256,TC_HEBREW,"I6/138",AL_HEBREW,"hebrew-iso" /* 6 */#endif /* HEBREW */};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 HEBREW "hebrew-iso", TC_HEBREW, 0,#endif /* HEBREW */#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, "ascii", "British/UK ISO-646", 128, FC_UKASCII, NULL, AL_ROMAN, "british", "Dutch ISO-646", 128, FC_DUASCII, NULL, AL_ROMAN, "dutch", "Finnish ISO-646", 128, FC_FIASCII, NULL, AL_ROMAN, "finnish", "French ISO-646", 128, FC_FRASCII, NULL, AL_ROMAN, "french", "Canadian-French NRC", 128, FC_FCASCII, NULL, AL_ROMAN, "canadian-french", "German ISO-646", 128, FC_GEASCII, NULL, AL_ROMAN, "german", "Hungarian ISO-646", 128, FC_HUASCII, NULL, AL_ROMAN, "hungarian", "Italian ISO-646", 128, FC_ITASCII, NULL, AL_ROMAN, "italian", "Norwegian/Danish ISO-646",128,FC_NOASCII,NULL,AL_ROMAN,"norwegian/danish", "Portuguese ISO-646", 128, FC_POASCII, NULL, AL_ROMAN,"portuguese", "Spanish ISO-646", 128, FC_SPASCII, NULL, AL_ROMAN, "spanish", "Swedish ISO-646", 128, FC_SWASCII, NULL, AL_ROMAN, "swedish", "Swiss NRC", 128, FC_CHASCII, NULL, AL_ROMAN, "swiss", "ISO 8859-1 Latin-1", 256, FC_1LATIN, NULL, AL_ROMAN,"latin1-iso",#ifdef LATIN2 "ISO 8859-2 Latin-2", 256, FC_2LATIN, NULL, AL_ROMAN,"latin2-iso",#endif /* LATIN2 */ "DEC Multinational", 256, FC_DECMCS, NULL,AL_ROMAN,"dec-multinational", "NeXT Multinational", 256, FC_NEXT, NULL,AL_ROMAN,"next-multinational", "IBM Code Page 437", 256, FC_CP437, NULL, AL_ROMAN,"cp437", "IBM Code Page 850", 256, FC_CP850, NULL, AL_ROMAN,"cp850",#ifdef LATIN2 "IBM Code Page 852", 256, FC_CP852, NULL, AL_ROMAN,"cp852",#endif /* LATIN2 */ "Apple Macintosh Latin", 256, FC_APPQD, NULL, AL_ROMAN,"macintosh-latin", "Data General International",256,FC_DGMCS,NULL,AL_ROMAN,"dg-international", "Hewlett Packard Roman8", 256, FC_HPR8, NULL, AL_ROMAN, "hp-roman8"#ifdef CYRILLIC, "ISO 8859-5 Latin/Cyrillic", 256, FC_CYRILL, NULL, AL_CYRIL,"cyrillic-iso", "CP866 Cyrillic", 256, FC_CP866, NULL, AL_CYRIL,"cp866", "Short KOI", 128, FC_KOI7, NULL, AL_CYRIL,"short-koi", "Old KOI-8 Cyrillic", 256, FC_KOI8, NULL, AL_CYRIL,"koi8-cyrillic"#endif /* CYRILLIC */#ifdef KANJI, "Japanese JIS7", 256, FC_JIS7, NULL, AL_JAPAN, "jis7-kanji", "Japanese Shift JIS", 16384, FC_SHJIS, NULL, AL_JAPAN, "shift-jis-kanji", "Japanese EUC", 16384, FC_JEUC, NULL, AL_JAPAN, "japanese-euc", "Japanese DEC Kanji", 16384, FC_JDEC, NULL, AL_JAPAN, "dec-kanji"#endif /* KANJI */#ifdef HEBREW, "Hebrew-7 DEC", 128, FC_HE7, NULL, AL_HEBREW, "hebrew-7", "ISO 8859-8 Latin/Hebrew",256, FC_HEBREW, NULL, AL_HEBREW, "hebrew-iso", "CP862 Hebrew", 256, FC_CP862, NULL, AL_HEBREW, "cp862-hebrew"#endif /* HEBREW */};/* 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 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -