Added new config file token XlatCharSetAlias that defines charset aliases for import tables

This commit is contained in:
Ianos Gnatiuc 2005-12-27 13:40:47 +00:00
parent ca3787c5a1
commit 99990d1f22
10 changed files with 59 additions and 2 deletions

View File

@ -1411,6 +1411,10 @@ XLATCHARSET CP1251 +7_FIDO win_866.chs
;XLATCHARSET CP850 ASCII 850_ASC.CHS
;XLATCHARSET CP850 MNEMONIC 850_MNE.CHS
// This defines charset aliases for import tables.
;XLATCHARSETALIAS "charset" "alias1" "alias2"...
;XLATCHARSETALIAS ISO-11 ISO-8859-11 ISO8859-11
// The character set that incoming messages are assumed to have.
XLATIMPORT IBMPC ; Default
;XLATIMPORT LATIN-1

View File

@ -1654,6 +1654,12 @@ XlatCharSet CP866 COMPOSED 866_CMP.chs
XlatCharSet CP866 VT100 866_VT1.chs
XlatCharSet CP850 ASCII 850_ASC.chs
// <20>⨬ ¬®¦­® ®¯à¥¤¥«¨âì  «¨ áë ¤«ï ­ §¢ ­¨© ª®¤¨à®¢®ª.
// <20> ¡®â ¥â ⮫쪮 ¤«ï â ¡«¨æ ¨¬¯®àâ .
;XLATCHARSETALIAS "charset" "alias1" "alias2"...
;XLATCHARSETALIAS KOI8-R KOI8R
;XLATCHARSETALIAS ISO ISO-8859-5 ISO8859-5
// Ž¯à¥¤¥«¥­¨¥ ¢å®¤ï饩 ª®¤¨à®¢ª¨ ¯® 㬮«ç ­¨î. …᫨ ¯à¨å®¤ï饥
// á®®¡é¥­¨¥ ­¥ ¨¬¥¥â ª«ã¤¦  ^CHRS, â® ¡ã¤¥â áç¨â âìáï, çâ® ®­®
// ᮮ⢥âáâ¢ã¥â í⮬㠭 ¡®àã ᨬ¢®«®¢.

View File

@ -10,6 +10,9 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, /snapshot/
______________________________________________________________________
+ Added new config file token: XlatCharSetAlias "charset" "alias1" "alias2"...
that defines charset aliases for import tables.
- Fixed destination address selection for commented replays in echo areas.
+ Now golded+ can draw box lines. Use keyboard configuration keyword

View File

@ -404,6 +404,7 @@ const word CRC_WILDCATUSERNO = 0xC2FE;
const word CRC_WRITEHEADER = 0x2589;
const word CRC_WRITETEMPLATE = 0xF4CB;
const word CRC_XLATCHARSET = 0xA860;
const word CRC_XLATCHARSETALIAS = 0x8B19;
const word CRC_XLATESCSET = 0x4BA7;
const word CRC_XLATEXPORT = 0x29CB;
const word CRC_XLATIMPORT = 0xCE6A;

View File

@ -619,6 +619,7 @@ SwitchW:
SwitchX:
switch(crc) {
case CRC_XLATCHARSET : CfgXlatcharset (); break;
case CRC_XLATCHARSETALIAS : CfgXlatcharsetalias (); break;
case CRC_XLATESCSET : CfgXlatescset (); break;
case CRC_XLATEXPORT : CfgXlatexport (); break;
case CRC_XLATIMPORT : CfgXlatimport (); break;

View File

@ -586,6 +586,27 @@ void CfgXlatcharset() {
// ------------------------------------------------------------------
void CfgXlatcharsetalias()
{
char* key;
getkeyval(&key, &val);
if (key[0] == 0) return;
std::pair<std::string, gstrarray> aliases;
aliases.first = key;
do
{
aliases.second.push_back(std::string(key));
getkeyval(&key, &val);
}
while (key[0] != 0);
CFG->xlatcharsetalias.push_back(aliases);
}
// ------------------------------------------------------------------
void CfgXlatescset() {
Map xlt;

View File

@ -385,6 +385,7 @@ void CfgWildcatuserno ();
void CfgWriteheader ();
void CfgWritetemplate ();
void CfgXlatcharset ();
void CfgXlatcharsetalias ();
void CfgXlatescset ();
void CfgXlatexport ();
void CfgXlatimport ();

View File

@ -383,6 +383,7 @@ public:
std::string wtpl;
std::vector<Map> xlatcharset;
std::vector<Map> xlatescset;
std::vector< std::pair<std::string, gstrarray> > xlatcharsetalias;
char xlatexport[17]; // exportcharset[17];
char xlatimport[17]; // localcharset[17];
char xlatlocalset[17];

View File

@ -126,6 +126,7 @@ void Cleanup(void) {
CFG->username.clear();
CFG->xlatcharset.clear();
CFG->xlatescset.clear();
CFG->xlatcharsetalias.clear();
CFG->cmdkey.clear();
CFG->macro.clear();
CFG->unpacker.clear();

View File

@ -2890,8 +2890,26 @@ int LoadCharset(const char* imp, const char* exp, int query) {
// Find and load charset table
std::vector<Map>::iterator xlt;
for(n = 0, xlt = CFG->xlatcharset.begin(); xlt != CFG->xlatcharset.end(); xlt++, n++) {
if(striinc(xlt->imp, imp) and striinc(xlt->exp, exp)) {
for(n = 0, xlt = CFG->xlatcharset.begin(); xlt != CFG->xlatcharset.end(); xlt++, n++)
{
if (!striinc(xlt->exp, exp)) continue;
bool imp_found = make_bool(striinc(xlt->imp, imp));
std::vector< std::pair<std::string, gstrarray> >::iterator als;
for (als = CFG->xlatcharsetalias.begin();
!imp_found && (als != CFG->xlatcharsetalias.end()); als++)
{
if (strieql(xlt->imp, als->first.c_str()))
{
for (gstrarray::iterator it = als->second.begin(); !imp_found && (it != als->second.end()); it++)
if (striinc(it->c_str(), imp))
imp_found = true;
}
}
if (imp_found)
{
// Already loaded?
if(CharTable and CharTable->level!=0 and n==current_table)
return CharTable->level;