X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fencoding.C;h=118b6a6a84dcadcb81812d65d0cfab4f5b0e0882;hb=34d28f9daae536db06d6cf1a9dcf62dc0f5aa432;hp=d875235781387369c7222ec144eba5c8037aa044;hpb=ba01a232eaea8162ca7980b552f21ab3b7689744;p=lyx.git diff --git a/src/encoding.C b/src/encoding.C index d875235781..118b6a6a84 100644 --- a/src/encoding.C +++ b/src/encoding.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-2000 The LyX Team. + * Copyright 1995-2001 The LyX Team. * * ====================================================== */ @@ -21,7 +21,8 @@ using std::endl; Encodings encodings; -static +namespace { + Uchar tab_iso8859_1[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, @@ -42,7 +43,6 @@ Uchar tab_iso8859_1[256] = { }; #ifdef USE_UNICODE_FOR_SYMBOLS -static Uchar tab_symbol[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, @@ -96,7 +96,6 @@ Uchar tab_symbol[256] = { #endif -static unsigned char arabic_table2[63][4] = { {0x41, 0x41, 0x41, 0x41}, // 0xc1 = hamza {0x42, 0xa1, 0x42, 0x42}, // 0xc2 = ligature madda on alef @@ -167,7 +166,6 @@ unsigned char arabic_table2[63][4] = { }; -static unsigned char arabic_table[63][2] = { {0xc1, 0xc1}, // 0xc1 = hamza {0xc2, 0xc2}, // 0xc2 = ligature madda on alef @@ -238,6 +236,11 @@ unsigned char arabic_table[63][2] = { }; +unsigned char const arabic_start = 0xc1; + +} // namespace anon + + bool Encodings::IsComposeChar_hebrew(unsigned char c) { return c <= 0xd2 && c >= 0xc0 && @@ -251,10 +254,6 @@ bool Encodings::IsComposeChar_arabic(unsigned char c) } -static -unsigned char const arabic_start = 0xc1; - - bool Encodings::is_arabic(unsigned char c) { return c >= arabic_start && arabic_table[c-arabic_start][0]; @@ -267,7 +266,7 @@ unsigned char Encodings::TransformChar(unsigned char c, if (!is_arabic(c)) return c; - if (lyxrc.font_norm == "iso10646-1") + if (lyxrc.font_norm_type == LyXRC::ISO_10646_1) return arabic_table2[c-arabic_start][form]; else return arabic_table[c-arabic_start][form >> 1]; @@ -278,7 +277,7 @@ Encoding const * Encodings::getEncoding(string const & encoding) const { EncodingList::const_iterator it = encodinglist.find(encoding); if (it != encodinglist.end()) - return &(*it).second; + return &it->second; else return 0; } @@ -309,19 +308,19 @@ void Encodings::read(string const & filename) LyXLex lex(encodingtags, et_last - 1); lex.setFile(filename); - while (lex.IsOK()) { + while (lex.isOK()) { switch (lex.lex()) { case et_encoding: { lex.next(); - string name = lex.GetString(); + string const name = lex.getString(); lex.next(); - string latexname = lex.GetString(); + string const latexname = lex.getString(); lyxerr[Debug::INIT] << "Reading encoding " << name << endl; Uchar table[256]; for (unsigned int i = 0; i < 256; ++i) { lex.next(); - string tmp = lex.GetString(); + string const tmp = lex.getString(); table[i] = ::strtol(tmp.c_str(), 0 , 16); } encodinglist[name] = Encoding(name, latexname, table);