📄 lycharsets.c
字号:
"y", /* small y, dieresis or umlaut mark (ÿ) - yuml */};/* * Add your new character sets HERE (but only if you * can't construct Unicode tables for them). - FM *//* * Add the array name to LYCharSets */PUBLIC char ** LYCharSets[MAXCHARSETS]={ ISO_Latin1, /* ISO Latin 1 */ SevenBitApproximations, /* DosLatin1 (cp850) */ SevenBitApproximations, /* WinLatin1 (cp1252) */ SevenBitApproximations, /* DosLatinUS (cp437) */ SevenBitApproximations, /* DEC Multinational */ SevenBitApproximations, /* Macintosh (8 bit) */ SevenBitApproximations, /* NeXT character set */ SevenBitApproximations, /* Chinese */ SevenBitApproximations, /* Japanese (EUC) */ SevenBitApproximations, /* Japanese (SJIS) */ SevenBitApproximations, /* Korean */ SevenBitApproximations, /* Taipei (Big5) */ SevenBitApproximations, /* Vietnamese (VISCII) */ SevenBitApproximations, /* 7 Bit Approximations */ SevenBitApproximations, /* Transparent */};/* * Add the name that the user will see below. * The order of LYCharSets and LYchar_set_names MUST be the same */PUBLIC CONST char * LYchar_set_names[MAXCHARSETSP]={ "ISO Latin 1 ", "DosLatin1 (cp850) ", "WinLatin1 (cp1252) ", "DosLatinUS (cp437) ", "DEC Multinational ", "Macintosh (8 bit) ", "NeXT character set ", "Chinese ", "Japanese (EUC) ", "Japanese (SJIS) ", "Korean ", "Taipei (Big5) ", "Vietnamese (VISCII) ", "7 bit approximations", "Transparent ", (char *) 0};/* * Associate additional pieces of info with each of the charsets listed * above. * Will be automatically modified (and extended) by charset translations * which are loaded using the chartrans mechanism. * Most important piece of info to put here is a MIME charset name. * Used for chartrans. * The order of LYCharSets and LYCharSet_UC MUST be the same. * * Note that most of the charsets added by the new mechanism in src/chrtrans * don't show up here at all. They don't have to. */PUBLIC LYUCcharset LYCharSet_UC[MAXCHARSETS]={ /* * Zero position placeholder and HTMLGetEntityUCValue() reference. - FM */ {-1,"iso-8859-1", UCT_ENC_8BIT, UCT_REP_IS_LAT1, UCT_CP_IS_LAT1, UCT_R_LAT1,UCT_R_LAT1}, /* * Placeholders for Unicode tables. - FM */ {-1,"cp850", UCT_ENC_8BIT, UCT_REP_SUPERSETOF_LAT1, 0, UCT_R_8BIT,UCT_R_ASCII}, {-1,"cp1252", UCT_ENC_8BIT, UCT_REP_SUPERSETOF_LAT1, 0, UCT_R_8BIT,UCT_R_ASCII}, {-1,"cp437", UCT_ENC_8BIT,0,0, UCT_R_8BIT,UCT_R_ASCII}, {-1,"dec-mcs", UCT_ENC_8BIT,0,0, UCT_R_8BIT,UCT_R_ASCII}, {-1,"macintosh", UCT_ENC_8BIT,0,0, UCT_R_8BIT,UCT_R_ASCII}, {-1,"next", UCT_ENC_8BIT,0,0, UCT_R_8BIT,UCT_R_ASCII}, /* * There is no strict correlation for the next five, since the transfer * charset gets decoded into Display Char Set by the CJK code (separate * from Unicode mechanism). For now we use the MIME name that describes * what is output to the terminal. - KW */ {-1,"euc-cn", UCT_ENC_CJK,0,0, UCT_R_8BIT,UCT_R_ASCII}, {-1,"euc-jp", UCT_ENC_CJK,0,0, UCT_R_8BIT,UCT_R_ASCII}, {-1,"shift_jis", UCT_ENC_CJK,0,0, UCT_R_8BIT,UCT_R_ASCII}, {-1,"euc-kr", UCT_ENC_CJK,0,0, UCT_R_8BIT,UCT_R_ASCII}, {-1,"big5", UCT_ENC_CJK,0,0, UCT_R_8BIT,UCT_R_ASCII}, /* * Placeholders for Unicode tables. - FM */ {-1,"viscii", UCT_ENC_8BIT_C0,0,0, UCT_R_8BIT,UCT_R_ASCII}, {-1,"us-ascii", UCT_ENC_7BIT, UCT_REP_SUBSETOF_LAT1, UCT_CP_SUBSETOF_LAT1, UCT_R_ASCII,UCT_R_ASCII}, /* * Placeholder for non-translation mode. - FM */ {-1,"x-transparent", UCT_ENC_8BIT,0,0, UCT_R_8BIT,UCT_R_ASCII}};/* * Add the code of the the lowest character with the high bit set * that can be directly displayed. * The order of LYCharSets and LYlowest_eightbit MUST be the same. * * (If charset have chartrans unicode table, * LYlowest_eightbit will be verified/modified anyway.) */PUBLIC int LYlowest_eightbit[MAXCHARSETS]={ 160, /* ISO Latin 1 */ 128, /* DosLatin1 (cp850) */ 130, /* WinLatin1 (cp1252) */ 128, /* DosLatinUS (cp437) */ 160, /* DEC Multinational */ 128, /* Macintosh (8 bit) */ 128, /* NeXT character set */ 128, /* Chinese */ 128, /* Japanese (EUC) */ 128, /* Japanese (SJIS) */ 128, /* Korean */ 128, /* Taipei (Big5) */ 128, /* Vietnamese (VISCII) */ 999, /* 7 bit approximations */ 128 /* Transparent (???) */};/* * The default character set. * -------------------------- * Use lynx.cfg and/or user * 'o'ptions (.lynxrc) to * set a different default. */PUBLIC char** p_entity_values = ISO_Latin1; /* Pointer to translation */PUBLIC int current_char_set = 0; /* Index for translation *//* * Function to set the handling of selected character sets * based on the current LYUseDefaultRawMode value. - FM */PUBLIC void HTMLSetCharacterHandling ARGS1(int,i){ int chndl = -2; if (LYCharSet_UC[i].enc != UCT_ENC_CJK) { chndl = 0; if (UCAssume_MIMEcharset) chndl = UCGetLYhndl_byMIME(UCAssume_MIMEcharset); HTCJK = NOCJK; kanji_code = NOKANJI; HTPassEightBitNum = ((LYCharSet_UC[i].codepoints & UCT_CP_SUPERSETOF_LAT1) || (LYCharSet_UC[i].like8859 & UCT_R_HIGH8BIT)); if (i == (chndl < 0 ? 0 : chndl)) { LYRawMode = LYUseDefaultRawMode ? TRUE : FALSE; } else { LYRawMode = LYUseDefaultRawMode ? FALSE : TRUE; } if (LYRawMode) { HTPassEightBitRaw = (LYlowest_eightbit[i] <= 160); } else { HTPassEightBitRaw = FALSE; } if (LYRawMode || i == chndl) { HTPassHighCtrlRaw = (LYlowest_eightbit[i] <= 130); } else { HTPassHighCtrlRaw = FALSE; } HTPassHighCtrlNum = FALSE; } else if (!strncmp(LYchar_set_names[i], "Chinese", 7)) { HTCJK = LYUseDefaultRawMode ? CHINESE : NOCJK; LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE; kanji_code = EUC; HTPassEightBitRaw = FALSE; HTPassEightBitNum = FALSE; HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE; HTPassHighCtrlNum = FALSE; } else if (!strncmp(LYchar_set_names[i], "Japanese (EUC)", 14)) { HTCJK = LYUseDefaultRawMode ? JAPANESE : NOCJK; LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE; kanji_code = EUC; HTPassEightBitRaw = FALSE; HTPassEightBitNum = FALSE; HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE; HTPassHighCtrlNum = FALSE; } else if (!strncmp(LYchar_set_names[i], "Japanese (SJIS)", 15)) { HTCJK = LYUseDefaultRawMode ? JAPANESE : NOCJK; LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE; kanji_code = SJIS; HTPassEightBitRaw = FALSE; HTPassEightBitNum = FALSE; HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE; HTPassHighCtrlNum = FALSE; } else if (!strncmp(LYchar_set_names[i], "Korean", 6)) { HTCJK = LYUseDefaultRawMode ? KOREAN : NOCJK; LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE; kanji_code = EUC; HTPassEightBitRaw = FALSE; HTPassEightBitNum = FALSE; HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE; HTPassHighCtrlNum = FALSE; } else if (!strncmp(LYchar_set_names[i], "Taipei (Big5)", 13)) { HTCJK = LYUseDefaultRawMode ? TAIPEI : NOCJK; LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE; kanji_code = EUC; HTPassEightBitRaw = FALSE; HTPassEightBitNum = FALSE; HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE; HTPassHighCtrlNum = FALSE; } else { HTCJK = NOCJK; kanji_code = NOKANJI; HTPassEightBitRaw = LYUseDefaultRawMode ? FALSE : TRUE; LYRawMode = HTPassEightBitRaw; HTPassEightBitNum = FALSE; HTPassHighCtrlRaw = FALSE; HTPassHighCtrlNum = FALSE; } if (LYRawMode) { UCLYhndl_for_unspec = i; } else { if (chndl == -2) { chndl = 0; if (UCAssume_MIMEcharset) chndl = UCGetLYhndl_byMIME(UCAssume_MIMEcharset); } if (chndl != i && chndl >= 0 && (LYCharSet_UC[i].enc != UCT_ENC_CJK || LYCharSet_UC[chndl].enc != UCT_ENC_CJK)) { UCLYhndl_for_unspec = chndl; } else { UCLYhndl_for_unspec = 0; } }#ifdef USE_SLANG if (LYlowest_eightbit[i] > 191) { /* * Higher than this may output cntrl chars to screen. - KW */ SLsmg_Display_Eight_Bit = 191; } else { SLsmg_Display_Eight_Bit = LYlowest_eightbit[i]; }#endif /* USE_SLANG */ ena_csi((LYlowest_eightbit[current_char_set] > 155)); return;}/* * Function to set the LYDefaultRawMode value * based on the selected character set. - FM */PUBLIC void HTMLSetRawModeDefault ARGS1(int,i){ if (!strncmp(LYchar_set_names[i], "ISO Latin 1", 11) || !strncmp(LYchar_set_names[i], "Chinese", 7) || !strncmp(LYchar_set_names[i], "Japanese (EUC)", 14) || !strncmp(LYchar_set_names[i], "Japanese (SJIS)", 15) || !strncmp(LYchar_set_names[i], "Korean", 6) || !strncmp(LYchar_set_names[i], "Taipei (Big5)", 13)) { LYDefaultRawMode = TRUE; } else { LYDefaultRawMode = FALSE; } return;}/* * Function to set the LYUseDefaultRawMode value * based on the selected character set and the * current LYRawMode value. - FM */PUBLIC void HTMLSetUseDefaultRawMode ARGS2( int, i, BOOLEAN, modeflag){ if (LYCharSet_UC[i].enc != UCT_ENC_CJK) { int chndl = 0; if (UCAssume_MIMEcharset) chndl = UCGetLYhndl_byMIME(UCAssume_MIMEcharset); if (i == chndl) LYUseDefaultRawMode = modeflag; else LYUseDefaultRawMode = (!modeflag);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -